You guys might remember the 'assigned' PK issue which I resolved by putting the following xdoclet into the javadoc of my ID field:
 
 /** Gets the guid.
  *
  * @return Returns the guid.
  * @hibernate.id column="guid" generator-class="assigned" unsaved-value="null"
  */
 public String getGuid() {
  return guid;
 }
 
Now, another issue I discovered was that saveOrUpdate didn't work and the solution was to specifically call save() or update() and that I had to manage the uniqueness of my assigned primary key myself. So far so good....
 
The problem I have is that update() NEVER works. I always get a 'unique id integrity problem' (or something like it) when trying to update my entry. I wrote some code that checks if an entry of the given ID existed and if so, calls the update method (and save otherwise), but I still get that error. Another attempt of deleting the object and then storing it resulted in the old faithful: "a different object with the same identifier value was already associated with the session:" - something other people already had some fun with in the past.
 
Fact is that I cannot have my client code perform the checking/deleting of existing entries. I need them to be able to just call saveXXXX(String id). What are my options at this point? I know that switching the PK to 'auto-generated' would alleviate all these problems, but the group is pretty insistend on sticking with the current schema.
 
Any input on this [before the long weekend] would be very much appreciated.
 
Enjoy your Labor Day weekend!
 
Michael

Reply via email to