-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate & JPA: persist collection of element from an obj.
PostPosted: Fri Jul 29, 2011 10:19 am 
Beginner
Beginner

Joined: Wed Nov 03, 2010 1:05 pm
Posts: 24
Hello all,

I've small question regarding persist an object which contains a list of another object.

In my entity level I have the object Risk which contains a list of actions:

Risk table

Code:
  @OneToMany(cascade=CascadeType.ALL, mappedBy="risk")
  private Set <Action> actions;


Action table

Code:
  @ManyToOne
  @JoinColumns({
    @JoinColumn(name="P_ID", referencedColumnName="ID", insertable=false, updatable=false),
    @JoinColumn(name="V_NO", referencedColumnName="V_NO", insertable=false, updatable=false)
})
  private Risk risk;


When I get the risk object, I also get the complete list of associated actions.

But when I save the risk object by doing
Code:
session.save(risk);
, actions are totaly ignored and not persisted in the db.
Of course it works if I do a "session.save()" on all the actions of the risk but I don't like that.

Can someone help me on this?

Thx :-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.