-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: @GeneratedValue(strategy = IDENTITY)
PostPosted: Tue Feb 21, 2012 5:44 pm 
Newbie

Joined: Tue Feb 21, 2012 5:37 pm
Posts: 1
If I declared @GeneratedValue(strategy = IDENTITY) to an Id will this be generated automatically???

I am in an assumption that it creates automatically but throws the below error
Cannot insert the value NULL into column 'classification_id', table 'stack.x.classification'; column does not allow nulls. INSERT fails.

Code to insert

Code:
final EntityManager em = JPAUtil.getCurrentEntityManager();
    em.persist(classification);
    em.flush();
    em.clear();


Could someone please help.


Top
 Profile  
 
 Post subject: Re: @GeneratedValue(strategy = IDENTITY)
PostPosted: Wed Feb 22, 2012 9:30 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Can you please also post the schema of the db (=the create table statements hibernate produced to create the database schema)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.