[jboss-user] [EJB 3.0] - Re: compounded primary key with ejb 3.0

jfheintz do-not-reply at jboss.com
Wed Aug 22 04:45:36 EDT 2007


Here it is, and many thanks for your help

///////////////////  BrowserStatEJB3  /////////////////////
@javax.persistence.Entity
@javax.persistence.IdClass(BrowserStatPK.class)
@javax.persistence.Table(name="SI_BROWSERSTAT")
public class BrowserStatEJB3 {

private BrowserStatPK pk;
 
@javax.persistence.Column(name="view")
private int view;
 
@javax.persistence.Id
@javax.persistence.Column(name="timeUnit_timeUnitId", nullable=false, updatable=false, insertable=false)
private java.lang.Long timeUnitTimeUnitId;
  
@javax.persistence.ManyToOne(fetch = javax.persistence.FetchType.LAZY)
@javax.persistence.JoinColumn(name="timeUnit_timeUnitId")
private com.statinfo.stat.data.timeUnit.TimeUnitEJB3 timeUnit;


@javax.persistence.Id
@javax.persistence.Column(name="site_siteId", nullable=false, updatable=false, insertable=false)
private java.lang.Long siteSiteId;
   
@javax.persistence.ManyToOne(fetch = javax.persistence.FetchType.LAZY)
@javax.persistence.JoinColumn(name="site_siteId")
private com.statinfo.stat.data.site.SiteEJB3 site;


@javax.persistence.Id
@javax.persistence.Column(name="browserDesc_browserDescId", nullable=false, updatable=false, insertable=false)
private java.lang.String browserDescBrowserDescId;
  
@javax.persistence.ManyToOne(fetch = javax.persistence.FetchType.LAZY)
@javax.persistence.JoinColumn(name="browserDesc_browserDescId")
private com.statinfo.stat.data.parameter.browserDesc.BrowserDescEJB3 browserDesc;
  
public BrowserStatEJB3() {
}

 
public BrowserStatPK getPk() {
   return this.pk;
}

public void setPk(BrowserStatPK pk) {
   this.pk=pk;
}

public int getView() {
   return this.view;
}

public void setView(int value) {
   this.view=value;
}

}


///////////////////  BrowserStatPK  /////////////////////
public class BrowserStatPK implements java.io.Serializable {

final static long serialVersionUID = 1L;
private transient int _hashCode = 0;

public java.lang.Long timeUnitTimeUnitId;
public java.lang.Long siteSiteId;
public java.lang.String browserDescBrowserDescId;

public BrowserStatPK() {
}

public BrowserStatPK( java.lang.Long timeUnitTimeUnitId, java.lang.Long siteSiteId, java.lang.String browserDescBrowserDescId) {
   this.setTimeUnitTimeUnitId(timeUnitTimeUnitId);
   this.setSiteSiteId(siteSiteId);
   this.setBrowserDescBrowserDescId(browserDescBrowserDescId);
}

.. getter + setter ...

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

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



More information about the jboss-user mailing list