instance « Update « JPA Q&A





1. Will hibernate update the database when a persistence instance has been set but not changed?    stackoverflow.com

If I have an instance of a persistence object, and I set some members in like so:

MyThing thing = session.get(MyThing.class, id);
thing.setSomething(thing.getSomething());
session.update(thing);
Will this actually cause hibernate to issue an SQL update command ...

2. Sample persistence.xml for a production instance using jpa2 and hibernate 3.6.x    stackoverflow.com

    <property name="hibernate.generate_statistics" value="true"/>
In a production scenario, it would make sense to switch the above flag to false. What other flags should be modified so that hibernate engine ...

3. Startup problems with static instances of Persistent objects    forum.hibernate.org

We have a system where we make use of the HibernateSession and PersistentRootClass patterns. We have a number of Enum type of objects that we initialize from the database, but we are facing a recursion problem during startup. Here is an example of one of the Enum classes Code: public final class EnumType extends PersistentEnum implements Serializable, Comparable { ...

4. How to access the EntityPersister for a persistent instance?    forum.hibernate.org

Hibernate version: 2.1.6 How can I access the EntityPersister for a persistent instance? I can get the ClassMetadata for the class via SessionFactory.getClassMetaData(Class) and cast the returned value to an AbstractEntityClass, but I don't like "casting on faith". The ultimate objective is to get a handle on the IdentifierGenerator for the instance's persistent class. For this class, I want to sometimes ...

5. Persisting an interface instance?    forum.hibernate.org

I'm trying to persist an instance of an interface without knowing the implementation. I've created a Hibernate mapping file for the interface and the appropriate database table is created successfully. Unfortunately, when I try to persist the object, Hibernate throws the following exception: "No persister for: {interface implementation}" This occurrs because it attempts to look up the Persister for the specific ...

6. Duplicate persistent instances    forum.hibernate.org

7. saveOrUpdate and ignoring persistent instance    forum.hibernate.org

Query query = session.getNamedQuery( hsql ); prepareQuery( query, names, values ); Event event = ( Event) query.uniqueResult(); event.setFlag( true ); ...

8. Incorrect instance reference saved    forum.hibernate.org

Hibernate version: 3.1 ..beginTransaction(); MySmallObject localRef new MySmallObject(); // holds a collection session.save(localRef); MyOtherObject localRef2 = new MyOtherObject(); localRef2.setProperty(localRef) session.save(localRef2); // reusing the MySmallObject declaration above!! localRef = new MySmallObject(); // holds another collection session.save(localRef); // reusing the OtherObject declaration above!! localRef2 = new MyOtherObject(); localRef2.setProperty(localRef); session.save(localRef2); ..commit(); The strange effect that happens: All collectioins of localRef (for both instances) get ...

9. Error persisting a simple object : object is not an instance    forum.hibernate.org

Author Message marciobarroso Post subject: Error persisting a simple object : object is not an instance Posted: Sun Oct 29, 2006 8:54 pm Newbie Joined: Wed Apr 05, 2006 5:27 pm Posts: 6 Location: SP - BR Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Help me ... I tried everything what I could but I did ...





10. How to correctly remove shared instances?    forum.hibernate.org

Hi all, I have a many-to-many mapping between InitialStateType and Position and a one-to-many mapping between ActionsType and Position. Both mappings are unidirectional. A row in Position can be shared by InitialStateType and ActionsType (both lists have a reference on the same object in Java). Everything works fine except when I try to delete an instance of InitialStateType or ActionsType. I ...

11. begginer persisting an instance    forum.hibernate.org

Hello, I'm kind of a begginer with hibernate and I have a "problem" when I persist an object. I have the following mapping: Code: ...