javax.persistence.PersistenceException:org.hibernate.id.IdentifierGenerationException:

时间:2015-07-24 06:39:48

标签: java mysql api jpa jaxb

如何在 angular.module(myModule).controller('myCtrl', [ '$scope', function($scope) { $scope.type=""; $scope.openLink= function() { if ($scope.type === 'member') { //Here is where I want to access the type from the scope of the directive! $window.open('http://wwww.google.com, 'myWindow', 'menubar=0, width=600, height=680, scrollbars=yes, resizable=yes, top=180, left=350'); } }; } angular.module('myModule').directive('myDirective', function() { return { restrict: 'EA', require: 'ngModel', scope: { type: '=', fName: '=', lName: '=', }, templateUrl: '...', controller:function($scope){ $scope.type="member"; } }; } ); 中传递和设置ID?请帮帮我:)提前谢谢。这是我遇到的唯一问题。 BetRecordAgEBR类适用于使用BetRecordAgEBR的may数据库。

jpa

例外:

if ("GR".equals(dataType)) {
    ByteArrayInputStream bis = new ByteArrayInputStream(
                                    aw.getBytes());
    StreamSource ss = new StreamSource(bis);
    brElement = (JAXBElement<T>) jaxbUnmarshaller
                                    .unmarshal(ss, BetRecordAgGR.class);

    ret2 = brElement.getValue();
    counter++;
    if (counter > 100) {
        return brList;
    }
    /*
    *
    * String uuid1 = java.util.UUID.randomUUID()
    * .toString(); dataOpe.setEntityManager(em);
    * ret2.setID(uuid1); dataOpe.add(ret2);
    */
    brList.add((T) ret2);
    System.out.println(brList);
}

1 个答案:

答案 0 :(得分:0)

我将ret2更改为BetRecordAgGR ret2;

  if ("GR".equals(dataType)) {
     ByteArrayInputStream bis = new ByteArrayInputStream(
                                        aw.getBytes());
                                StreamSource ss = new StreamSource(bis);
                                brElement = (JAXBElement<T>) jaxbUnmarshaller
                                        .unmarshal(ss, BetRecordAgGR.class);

                                ret2= (BetRecordAgGR) brElement.getValue();
                                counter++;
                                if (counter > 100) {
                                    return brList;
                                }

                                String uuid1 = java.util.UUID.randomUUID()
                                        .toString();
                                ret2.setID(uuid1);
                                dataOpe.setEntityManager(em);
                                dataOpe.add(ret2);
                                brList.add((T) ret2);
                                System.out.println(brList);
                            }