Joined: Wed Apr 20, 2005 6:57 pm Posts: 9 Location: San Diego, Ca
|
Ok I got the composite-elements to work within an id bag and let me say they are awesome. So fast to load and they still work similar to entity objects. Excellent. The only problem I'm having is the Primary keys are not being set in my java object. All the other fields are set no problem. And I have played with it to the best of my ability. Middlegen will not generate the java object for the Projectcompound class listed below, so I had to write it by hand. Perhaps I wrote it incorrectly. The mapping works extremely well and everything else is fine, I just can't get the pk so it's difficult to update the object. Is this by design? Am I doing something lame? Thanks.
Hibernate version:
Hibernate 2
Mapping documents:
<idbag name="projectcompounds"
lazy="true"
table="PROJECTCMPD"
order-by="STARTDATE asc " >
<collection-id type="java.lang.Long" column="PROJECTCMPDID">
<generator class="sequence">
<param name="sequence">PROJECTCMPD_PKSEQ</param>
</generator>
</collection-id>
<key column="PROJECTID" />
<composite-element class="blah.blah.Projectcompound" >
<many-to-one
name="kstructure"
class="blah.blah.Kstructure"
not-null="true"
>
<column name="SID" />
</many-to-one>
<many-to-one
name="project"
class="blah.blah.Datadictionary"
not-null="true"
>
<column name="TYPE_LD" />
</many-to-one>
<property
name="mechanism"
type="java.lang.String"
column="MECHANISM"
length="255"
/>
<property
name="classs"
type="java.lang.String"
column="CLASS"
length="255"
/>
<property
name="name"
type="java.lang.String"
column="NAME"
length="255"
/>
<property
name="startreason"
type="java.lang.String"
column="STARTREASON"
length="4000"
/>
<property
name="endreason"
type="java.lang.String"
column="ENDREASON"
length="4000"
/>
<property
name="startdate"
type="java.sql.Timestamp"
column="STARTDATE"
length="3"
/>
<property
name="enddate"
type="java.sql.Timestamp"
column="ENDDATE"
length="3"
/>
</composite-element>
</idbag>
Name and version of the database you are using:
Oracle 9i
CODE:
public class Projectcompound implements Serializable {
private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Projectcompound.class);
private String mechanism = null;
private String name = null;
private String classs = null;
private String endreason = null;
private String startreason = null;
private Date startdate;
private Date enddate;
private blah.blah.Kstructure kstructure;
private blah.blah.Project project;
private blah.blah.Datadictionary typeLd;
private long projectcmpdid = -1;
public Projectcompound() {
logger.info( "888888888888888 88888 888 calling CTOR()" );
}
public Projectcompound( long projectcmpdid ) {
logger.info( "888888888888888 88888 888 calling CTOR( " +projectcmpdid+" )" );
this.projectcmpdid = projectcmpdid;
}
public void setProjectcmpdid( long projectcmpdid ) {
logger.info( "888888888888888 88888 888 calling setProjectcmpdid with [" +projectcmpdid+"]" );
this.projectcmpdid = projectcmpdid;
}
public long getProjectcmpdid() {
return this.projectcmpdid;
}
public void setMechanism( String mechanism ) {
logger.info( "888888888888888 88888 888 calling setMechanism with [" +mechanism+"]" );
this.mechanism = mechanism;
}
public String getMechanism() {
return this.mechanism;
}
public void setName( String name ) {
logger.info( "888888888888888 88888 888 calling setName with [" +name+"]" );
this.name = name;
}
public String getName() {
return this.name;
}
public void setClasss( String classs ) {
logger.info( "888888888888888 88888 888 calling setClasss with [" +classs+"]" );
this.classs = classs;
}
public String getClasss() {
return this.classs;
}
public void setEndreason( String endreason ) {
logger.info( "888888888888888 88888 888 calling setEndreason with [" +endreason+"]" );
this.endreason = endreason;
}
public String getEndreason() {
return this.endreason;
}
public void setStartreason( String startreason ) {
logger.info( "888888888888888 88888 888 calling setStartreason with [" +startreason+"]" );
this.startreason = startreason;
}
public String getStartreason() {
return this.startreason;
}
public void setStartdate( Date startdate ) {
logger.info( "888888888888888 88888 888 calling setStartdate with [" +startdate+"]" );
this.startdate = startdate;
}
public Date getStartdate() {
return this.startdate;
}
public void setEnddate( Date enddate ) {
this.enddate = enddate;
}
public Date getEnddate() {
return this.enddate;
}
public void setKstructure( Kstructure kstructure ) {
this.kstructure = kstructure;
}
public Kstructure getKstructure() {
return this.kstructure;
}
public void setProject( Project project ) {
this.project = project;
}
public Project getProject() {
return this.project;
}
public void setTypeLd( Datadictionary typeLd ) {
this.typeLd = typeLd;
}
public Datadictionary getTypeLd() {
return this.typeLd;
}
|
|