The moose likes Object Relational Mapping and the fly likes Check the id Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Check the id" Watch "Check the id" New topic

Check the id

Karel Vervaeke

Joined: Jul 20, 2004
Posts: 4
You're saying your id has unsaved-value=null,
you should make sure that the java-type of this id is nullable.
int id; // is not nullable.

You should either
1) specify an unsaved-value (e.g. -1) and make sure you set the id to -1 when constructing the persistent object.

2) use an Integer id; (default=null)

Karel Vervaeke

Joined: Jul 20, 2004
Posts: 4
Oops, that was supposed to be a reply to

I'm reposting it there right now, moderators, please delete this thread :/
I agree. Here's the link: http://aspose.com/file-tools
subject: Check the id
Similar Threads
type "Long" and primitive "long"
The value of NULL in MySQL
one-to-many relation
Hibernate Identifier and primitive types
What is the better choice for primary key ? natural key or system-generated key ?