merge « Key « JPA Q&A

1. JPA merge fails due to duplicate key

I have a simple entity, Code, that I need to persist to a MySQL database.

public class Code implements Serializable {

    private String key;

2. Hibernate not updating (merging) object

I have tag object that is driving me crazy. I'm trying to update it and every time I do everything seems OK until I check the database and it is not ...

3. call to .merge() method returns the object without keys.

Hello Friend: If u see the hibernates API document about the method merge(Object) of the class Session, it indicate: [u]Copy the state of the given object onto the persistent object with the same identifier. If there is no persistent instance currently associated with the session, it will be loaded. Return the persistent instance. If the given instance is unsaved, save a ...

4. How to handle unique-key only on table merge

Hello, Basically I have a db with all my mappings working really well. Now we are scaling out our servers and adding a server_id column to enforce uniqueness on a table merge. I would do a composite key but then i lose the hilo generator I have working on my ids. how should i handle this? any suggestions? Thanks, lt