-->
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.  [ 3 posts ] 
Author Message
 Post subject: Help to map Id that's generated by a trigger
PostPosted: Thu Oct 26, 2006 11:52 pm 
Newbie

Joined: Tue Oct 24, 2006 5:38 pm
Posts: 5
Hi!

I'm really not sure how to map my id property in my class, since this id is generated in the db by a trigger. I've read the documentation and i had the impression that what i should do was:

class Users {

...

@Id
@Generated(GenerationTime.ALWAYS)
@Column(name="COD_USER", nullable=false,insertable = false, updatable = false)
public Long getCodUser() {
return codUsuario;
}
...
}

or

class Users {

...

@Id
@Generated(GenerationTime.INSERT)
@Column(name="COD_USER", nullable=false,insertable = false, updatable = false)
public Long getCodUser() {
return codUsuario;
}
...
}

But both of them get me this exception:

exception

javax.servlet.ServletException
javax.faces.webapp.FacesServlet.service(FacesServlet.java:209)

root cause

java.lang.NullPointerException
org.hibernate.cfg.annotations.PropertyBinder.make(PropertyBinder.java:145)
org.hibernate.cfg.AnnotationBinder.bindId(AnnotationBinder.java:1729)
org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1171)
org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:706)
org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:452)
org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:268)
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1210)


How am I supposed to map this?
Please i really need some help!
Thanks!
=)

_________________
jaq


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 27, 2006 1:13 pm 
Newbie

Joined: Tue Oct 24, 2006 5:38 pm
Posts: 5
No one can help me?

_________________
jaq


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 07, 2006 6:15 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
you need to look at something like @GenericGenerator(..., strategy="select")

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.