save « Key « JPA Q&A





1. Problem save a object with reference a key to other object    forum.hibernate.org

I have a object1 which have an other object2 who attribute, and in the base I want to save with the object1 the idkey to the other object2. the configured hibernate object1 is: .. and the object2 ...

2. parent key not found, Save two connected objects    forum.hibernate.org

My BO beans inherit from transactionProxyBean Code: ...

3. Not saving FK's to database    forum.hibernate.org

Hello, Im trying to save a simple @OneToMany reference to the database. It saves al the data but it doesn't save the FK's. My code looks like this: Code: @Entity @Table(name = "workweek") public class WorkWeek extends BaseEntity { private static final long serialVersionUID = -1601661198784559768L; @Id @GeneratedValue(strategy = GenerationType.AUTO) ...

4. PK generation before save()    forum.hibernate.org

i am instanciating an empty entity that is to be saved to db later. but i want to use the id of this entity in the constructor of this persistent class. when using the generator of hibernate the id is generated when saving the entity to db, but this should be done later and not in the constructor. so i want ...

5. Intermittently not saving foreign keys in one-to-many    forum.hibernate.org

Newbie Joined: Fri May 07, 2004 2:18 am Posts: 19 Hibernate version 2.1.6: Mapping documents: Session session = HibernateUtil.currentSession(); Transaction tx= session.beginTransaction(); doEntity(entity); session.saveOrUpdate(entity); doEntity(entity) session.update(entity); tx.commit(); HibernateUtil.closeSession(); Mysql 4.20: Hello I have a very weird problem. I have a class named entity. /** * @author Marcus * @hibernate.class table="entity" */ public abstract class Entity implements Externalizable{ public static final long ...

6. auto save fk?    forum.hibernate.org

[b]Hibernate version:2.6.1[/b] I have one to many relationship. I know Hibernate can save Collection automatically, But is there any way, Hibernate can automatic save fk without explicity call child.setParent(parent); //which cause terator each child in Parent again, just for set the relationship I like just pass a Parent with Child Colletion. Then it can save all relationship. public void saveAll(Parent parent){ ...

7. Newbie: foreign key save    forum.hibernate.org

Hi, I have two tables: Subscriber and Profile Each subscriber has max one profile. I have mapeed the profile as a foreign key association. However, when I create a new subscriber with an emtpy profile, the profile doesn't get saved. Subscriber.java /** * @hibernate.one-to-one outer-join="false" unsaved-value="null" * class="nl.msw.dates4free.business.entities.profile.Profile" cascade="all" * @return Returns the profile. */ public Profile getProfile() { return profile; ...

8. Changing Primary key and with save but get error    forum.hibernate.org

I save an objecting using a temp. primary key. I then change the key to another number. When I try to save the object, I get org.hibernate.HibernateException: Don't change the reference to a collection with cascade="all-delete-orphan": uchicago.nsit.accts.data.valueobject.DPHeaderVO.account_list session2 = sf.openSession(); Transaction trans2 = session2.beginTransaction(); session2.clear(); session2.flush(); transfer.setControlNumber(ctNumber.getControlNumber()); session2.save(transfer); session2.flush(); trans2.commit(); session2.close(); transfer was loaded previously and the control number changed. ...

9. ConstraintViolation - duplicate key on re-save.    forum.hibernate.org

Hi, I have a many to many mapping between Reports and Events and I can save my Report objects fine, and the Events get saved and associated through "reports_events" table. But if I do that once, then try to save an Event object that was related to a Report already, I cannot save the Event object by itself. It complains the ...





10. Saving with unique key    forum.hibernate.org

I'm using hibernate 3.0 with an Oracle database. I have a WEEKS table with ID, WEEK_NUMBER, and YEAR columns. There is a unique key on (WEEK_NUMBER, YEAR). When I save a Week object, I'd like to set the week number and the year, but I will not have the week id. What I'd like is for hibernate to check whether the ...

11. Saving of raw foreign key    forum.hibernate.org

Hi All, Is there an easy hibernate method of saving a single new child using a raw foreign key? I have the foreign key from an earlier Criteria query (used to populate a pull down box) used for performance reasons. I'm currently having to reload the parent and this is having a perfromance overhead. If I construct a transient parent object ...

12. one-to-one: foreign key: save Problem    forum.hibernate.org