OK, I'll try to paste some of the entity objetcs code to this thread.

Check out the Company and BranchPO below. All getter and setters omitted.

We're using a webservice to fill-out CompanyPO with information. Som companies 
have more then 700 branches, which all are aded to the branches collection of 
CompanyPO. 

After finishing the company with all the branches, address etc. the company 
entity is persisted, if all rules is passed. 
The persists operation completes succesfully after about half a secondf, but 
when we then are doing a flush operation on the entitymanager the container 
will hang and after a while a timeout is thrown.

Maybe a solution is to perstist and flush more often, which shouldn't be 
neccesary with the relative small data amount. But, I'll give it try anyway. 

If you need more information please tell me which.

-----  Source code ----


** CompanyPO **
Id column is inherited. 

public class CompanyPO extends RegisteredEntityPO implements Serializable {

  @Column(name = "CVR_NO", unique = true, nullable=false)
  private String cvrNo;
  
  @OneToMany(mappedBy = "company", cascade = {CascadeType.PERSIST, 
CascadeType.MERGE})
  private Collection branches;
  
  @ManyToMany(fetch=FetchType.LAZY, cascade = {CascadeType.PERSIST, 
CascadeType.MERGE})
  @JoinTable(table = @Table(name = "HV_COMPANY_MANAGERS")
            ,joinColumns = [EMAIL PROTECTED](name="COMPANY_ID")}
            ,inverseJoinColumns = [EMAIL PROTECTED](name="MANAGER_ID")}
            )
  private Collection managerList;
  //@Transient
  //private Collection managerList = new ArrayList();
  
  @ManyToMany(fetch=FetchType.LAZY, cascade = {CascadeType.MERGE, 
CascadeType.PERSIST})
  @JoinTable(table = @Table(name = "HV_COMPANY_OWNERS")
            ,joinColumns = [EMAIL PROTECTED](name="COMPANY_ID")}
            ,inverseJoinColumns = [EMAIL PROTECTED](name="OWNER_ID")}
            )
  private Collection ownerList;

  @ManyToOne(optional=true)
  private AgentPO agentFor;
}

** Branch PO **

@Entity(access=AccessType.FIELD)
@Table(name = "HV_BRANCH")
@SequenceGenerator(name="BRAN_SEQ_GEN", 
sequenceName="HV_BRAN_SEQ",allocationSize=1)
public class BranchPO implements StateObject, Serializable {
  
  @Id (generate=GeneratorType.SEQUENCE,generator="BRAN_SEQ_GEN")
  private int id;

  @Column(name="P_NO")
  private String pNo;

  private String name;

  @ManyToOne(optional = false, cascade = {CascadeType.PERSIST, 
CascadeType.MERGE})
  private CompanyPO company;

  @OneToOne(optional=false, cascade={CascadeType.PERSIST, CascadeType.MERGE})
  @JoinColumn(name="ADDR_ID", unique=false, nullable=false)
  private AddressPO address;

  @OneToOne(optional=true, cascade={CascadeType.PERSIST, CascadeType.MERGE})
  @JoinColumn(name="MANAGER_ID", unique=false)
  private BranchManagerPO manager;

  @Column(name="IS_JOINED")
  private boolean joined;

  @ManyToOne(optional=true, cascade={CascadeType.PERSIST, CascadeType.MERGE, 
CascadeType.REFRESH})
  @JoinColumn(name="SHIS_ID")
  private StatusHistoryPO currentStatus;
  
  @OneToMany(mappedBy="branch", fetch=FetchType.LAZY)
  private Collection statusHistory;
}

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3934603#3934603

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3934603


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to