File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Make it so: Java DB Connections & Transactions this week in the JDBC 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:
subject: Check the id
It's not a secret anymore!