David, The GenericGenerator annotation was the solution i found worked for me for Hibernate 3.3.2GA, and the one i suggested you investigate. i'm glad you've gotten past that one.
Best wishes, --greg On Wed, Jun 24, 2009 at 3:29 PM, David Persons <[email protected]> wrote: > > Thanks for all the answers guys. > > I managed to fix the id problem, I needed the Hibernate specific class > GenericGenerator to fix it, which of cource is less pretty then using > only JPA. Someone has an example of how to make it work with MySql and > only JPA annotations? Current version: > > @Entity > class Scene { > @Id > @GenericGenerator{val name="hibernate-increment", val > strategy="increment"} > @GeneratedValue{val strategy = GenerationType.SEQUENCE, val > generator = "hibernate-increment"} > var id : Long = _ > > @Column{val unique = true, val nullable = false} > var ordering : Int = _ > > @Column{val unique = true, val nullable = false} > var name : String = "" > > @ManyToOne{val optional = false} > var storyBoard : StoryBoard = _ > } > > However, now I get an org.hibernate.PropertyValueException: not-null > property references a null or transient value: > model.Scene.storyBoard :-s I tried a lot of things already, the > corresponding StoryBoard is saved and not null, so I guess it has to > be transient. Merging the StoryBoard however still gives the same > error.. > > I tried to get JPA and Lift working together in the same way as in the > JPADemo example.. Is it the use of MySql which prevents the example > from working for me? > > regards, > David > > On 23 jun, 00:54, Derek Chen-Becker <[email protected]> wrote: > > Also, what does the schema for the entity's table look like? > > > > On Mon, Jun 22, 2009 at 4:54 PM, Derek Chen-Becker < > [email protected]>wrote: > > > > > Mind posting the snippet of code where you're saving the instance? A > merge > > > should interpret a null ID as a fresh instance, and a persist should > just > > > save it. > > > > > Derek > > > > > On Mon, Jun 22, 2009 at 1:50 PM, David Persons <[email protected] > >wrote: > > > > >> I am using MySql (5). After setting the hibernate.dialect to > > >> org.hibernate.dialect.MySQLDialect in my persistence.xml file, I get a > > >> org.hibernate.AssertionFailure: null id :-s > > > > >> cheers > > > > >> On 22 jun, 19:18, Derek Chen-Becker <[email protected]> wrote: > > >> > That's not accurate, at least with Hibernate. By putting the > annotations > > >> on > > >> > vars, the compiler ends up putting them on the internal fields, > which > > >> then > > >> > forces Hibernate into a field-based persistence model and not a > > >> > getter/setter based one. The SQLGrammarException is most likely what > the > > >> > other people have said. If you're in Oracle or PostgreSQL, for > instance, > > >> you > > >> > need a sequence set up for the auto identity model. What database > are > > >> you > > >> > using? > > > > >> > Derek > > > > >> > On Mon, Jun 22, 2009 at 8:54 AM, Eric Bowman <[email protected]> > wrote: > > > > >> > > David Persons wrote: > > >> > > > Hello guys, > > > > >> > > > I get a org.hibernate.exception.SQLGrammarException: could not > get > > >> or > > >> > > > update next value error everytime I try to save the following > > >> Entity: > > > > >> > > > @Entity > > >> > > > class Scene { > > >> > > > @Id > > >> > > > @GeneratedValue(){val strategy = GenerationType.AUTO} > > >> > > > var id : Long = _ > > > > >> > > > @Column{val unique = true, val nullable = false} > > >> > > > var ordering : Int = _ > > > > >> > > > @Column{val unique = true, val nullable = false} > > >> > > > var name : String = "" > > > > >> > > > @ManyToOne{val optional = false} > > >> > > > var storyBoard : StoryBoard = _ > > >> > > > } > > > > >> > > You almost certainly need some scala.reflect.BeanProperty > annotations > > >> on > > >> > > your fields. > > > > >> > > cheers, > > >> > > Eric > > > > >> > > -- > > >> > > Eric Bowman > > >> > > Boboco Ltd > > >> > > [email protected] > > >> > >http://www.boboco.ie/ebowman/pubkey.pgp > > >> > > +35318394189/+353872801532< > > >>http://www.boboco.ie/ebowman/pubkey.pgp%0A+35318394189/+353872801532> > > > > -- L.G. Meredith Managing Partner Biosimilarity LLC 1219 NW 83rd St Seattle, WA 98117 +1 206.650.3740 http://biosimilarity.blogspot.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---
