Update of /cvsroot/xdoclet/xdoclet/samples/src/java/test/hibernate21
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5115/samples/src/java/test/hibernate21
Modified Files:
CompositeId.java Product.java LineItem.java Human.java
Added Files:
Component1.java Part.java AbstractComponent.java PartId.java
Component2.java
Log Message:
updated tests
--- NEW FILE: Component1.java ---
/**
* Created on 16-May-2005
*/
package test.hibernate21;
/**
* @author galbrapa
*
*/
public class Component1 extends AbstractComponent {
private String component1Prop;
/**
* @hibernate.property
* @return Returns the component1Prop.
*/
public String getComponent1Prop() {
return component1Prop;
}
/**
* @param component1Prop The component1Prop to set.
*/
public void setComponent1Prop(String component1Prop) {
this.component1Prop = component1Prop;
}
/**
*
*/
public Component1() {
super();
// TODO Auto-generated constructor stub
}
}
--- NEW FILE: Part.java ---
/**
* Created on 13-May-2005
*/
package test.hibernate21;
import java.io.Serializable;
/**
* @hibernate.class table="PARTS" lazy="true"
*/
public class Part implements Serializable {
private PartId partId;
private String partName;
/**
* @hibernate.id generator-class="assigned"
*/
public PartId getPartId() {
return partId;
}
public void setPartId(PartId partId) {
this.partId = partId;
}
/**
* @hibernate.property
* @hibernate.column name="part_id"
*/
public String getPartName() {
return partName;
}
public void setPartName(String partName) {
this.partName = partName;
}
public boolean equals(Object obj) {
if (!(obj instanceof Part)) return false;
Part other = (Part) obj;
return this.partId.equals(other.partId);
}
}
--- NEW FILE: AbstractComponent.java ---
/**
* Created on 16-May-2005
*/
package test.hibernate21;
/**
* @author galbrapa
*
*/
public abstract class AbstractComponent {
private String commonProp;
/**
* @hibernate.property
* @return Returns the commonProp.
*/
public String getCommonProp() {
return commonProp;
}
/**
* @param commonProp The commonProp to set.
*/
public void setCommonProp(String commonProp) {
this.commonProp = commonProp;
}
/**
*
*/
public AbstractComponent() {
super();
// TODO Auto-generated constructor stub
}
}
--- NEW FILE: PartId.java ---
/**
* Created on 13-May-2005
*/
package test.hibernate21;
import java.io.Serializable;
public class PartId implements Serializable {
private Product product;
private Integer componentNumber;
/**
* @hibernate.many-to-one class="test.hibernate21.Product"
* @hibernate.column name="part_id"
*/
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
/**
* @hibernate.property
* @hibernate.column name="component_num"
*/
public Integer getComponentNumber() {
return componentNumber;
}
public void setComponentNumber(Integer componentNumber) {
this.componentNumber = componentNumber;
}
public boolean equals(Object obj) {
if (!(obj instanceof PartId)) return false;
PartId other = (PartId) obj;
if (!this.product.equals(other.product)) return false;
return this.componentNumber.equals(other.componentNumber);
}
}
--- NEW FILE: Component2.java ---
/**
* Created on 16-May-2005
*/
package test.hibernate21;
/**
* @author galbrapa
*
*/
public class Component2 extends AbstractComponent {
private String component2Prop;
/**
* @hibernate.property
* @return Returns the component2Prop.
*/
public String getComponent2Prop() {
return component2Prop;
}
/**
* @param component2Prop The component2Prop to set.
*/
public void setComponent2Prop(String component2Prop) {
this.component2Prop = component2Prop;
}
/**
*
*/
public Component2() {
super();
// TODO Auto-generated constructor stub
}
}
Index: CompositeId.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/samples/src/java/test/hibernate21/CompositeId.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** CompositeId.java 2 May 2005 14:36:59 -0000 1.1
--- CompositeId.java 17 May 2005 12:41:33 -0000 1.2
***************
*** 60,63 ****
--- 60,66 ----
* @return
* @hibernate.many-to-one
+ * @hibernate.column name="column1" unique="true"
+ * @hibernate.column name="column2" unique="false"
+ * @hibernate.column name="column3" unique="false"
*/
public Order getOrder()
Index: Product.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/samples/src/java/test/hibernate21/Product.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Product.java 2 May 2005 14:36:59 -0000 1.1
--- Product.java 17 May 2005 12:41:34 -0000 1.2
***************
*** 1,114 ****
! package test.hibernate21;
!
! import java.math.BigDecimal;
!
! /**
! * @hibernate.class
! * table="PRODUCTS"
! * discriminator-value="null"
! * dynamic-update="true"
! * @hibernate.discriminator
! * column="PRODUCT_TYPE"
! * type="string"
! * length="16"
! * not-null="false"
! * @hibernate.jcs-cache
! * usage="read-only"
! *
! * @author Administrator
! */
! public class Product extends Persistent implements Updateable {
!
! private String description;
! private String code;
! private BigDecimal price;
! private byte[] image;
! private String updateComment;
!
! /**
! * Constructor for Product.
! */
! public Product() {
! super();
! }
!
! /**
! * @hibernate.property
! * length="512"
! * @return String
! */
! public String getDescription() {
! return description;
! }
!
! /**
! * Sets the name.
! * @param name The name to set
! */
! public void setDescription(String name) {
! this.description = name;
! }
!
! /**
! * @hibernate.property
! * length="16"
! * unique="true"
! * update="false"
! * @return String
! */
! public String getCode() {
! return code;
! }
!
! /**
! * Sets the code.
! * @param code The code to set
! */
! public void setCode(String code) {
! this.code = code;
! }
!
! /**
! * @hibernate.property
! * length="4096"
! * Returns the image.
! * @return byte[]
! */
! public byte[] getImage() {
! return image;
! }
!
! /**
! * @hibernate.property
! * Returns the price.
! * @return BigDecimal
! */
! public BigDecimal getPrice() {
! return price;
! }
!
! /**
! * Sets the image.
! * @param image The image to set
! */
! public void setImage(byte[] image) {
! this.image = image;
! }
!
! /**
! * Sets the price.
! * @param price The price to set
! */
! public void setPrice(BigDecimal price) {
! this.price = price;
! }
!
! public String getUpdateComment() {
! return updateComment;
! }
!
! public void setUpdateComment(String string) {
! updateComment = string;
! }
!
! }
--- 1 ----
! package test.hibernate21;
import java.math.BigDecimal;
import java.util.Map;
/**
* @hibernate.class
* table="PRODUCTS"
* discriminator-value="null"
* dynamic-update="true"
*
* @hibernate.discriminator
* column="PRODUCT_TYPE"
* type="string"
* length="16"
* not-null="false"
*
* @hibernate.jcs-cache
* usage="read-only"
*
* @author Administrator
*/
public class Product extends Persistent implements Updateable {
private String description;
private String code;
private BigDecimal price;
private byte[] image;
private String updateComment;
private Map parts;
/**
* Constructor for Product.
*/
public Product() {
super();
}
/**
* @hibernate.property
* length="512"
* @return String
*/
public String getDescription() {
return description;
}
/**
* Sets the name.
* @param name The name to set
*/
public void setDescription(String name) {
this.description = name;
}
/**
* @hibernate.property
* length="16"
* unique="true"
* update="false"
* @return String
*/
public String getCode() {
return code;
}
/**
* Sets the code.
* @param code The code to set
*/
public void setCode(String code) {
this.code = code;
}
/**
* @hibernate.property
* length="4096"
* Returns the image.
* @return byte[]
*/
public byte[] getImage() {
return image;
}
/**
* @hibernate.property
* Returns the price.
* @return BigDecimal
*/
public BigDecimal getPrice() {
return price;
}
/**
* Sets the image.
* @param image The image to set
*/
public void setImage(byte[] image) {
this.image = image;
}
/**
* Sets the price.
* @param price The price to set
*/
public void setPrice(BigDecimal price) {
this.price = price;
}
public String getUpdateComment() {
return updateComment;
}
public void setUpdateComment(String string) {
updateComment = string;
}
/**
* @hibernate.map
* @hibernate.collection-key column="product_id"
* @hibernate.collection-composite-index class="test.hibernate21.PartId"
* @hibernate.collection-one-to-many class="test.hibernate21.Part"
*/
public Map getParts() {
return this.parts;
}
public void setParts(Map parts) {
this.parts = parts;
}
}
\ No newline at end of file
Index: LineItem.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/samples/src/java/test/hibernate21/LineItem.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** LineItem.java 2 May 2005 14:36:59 -0000 1.1
--- LineItem.java 17 May 2005 12:41:34 -0000 1.2
***************
*** 24,35 ****
/**
! * @hibernate.many-to-one
! * outer-join="true"
! * cascade="save-update"
! * column="ORDER_ID"
! * not-null="true"
! * unique="true"
! * sql-type="BIGINT"
! * @return Order
*/
public Order getOrder() {
--- 24,32 ----
/**
! * @hibernate.many-to-one outer-join="true" cascade="save-update"
! * not-null="true" unique="true"
sql-type="BIGINT"
! * @hibernate.column name="column1"
! * @hibernate.column name="column2"
! * @hibernate.column name="column3"
*/
public Order getOrder() {
Index: Human.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/samples/src/java/test/hibernate21/Human.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Human.java 2 May 2005 14:36:59 -0000 1.1
--- Human.java 17 May 2005 12:41:34 -0000 1.2
***************
*** 1,58 ****
! package test.hibernate21;
!
! /**
! * @author Administrator
! *
! * @hibernate.joined-subclass
! * table="HUMANS"
! * dynamic-update="true"
! * @hibernate.joined-subclass-key
! * column="ANIMAL_ID"
! */
! public class Human extends Animal {
!
! private Name name;
! private String occupation;
!
! /**
! * Constructor for Human.
! */
! public Human() {
! super();
! }
!
! /**
! * @hibernate.component
! * Returns the name.
! * @return Name
! */
! public Name getName() {
! return name;
! }
!
! /**
! * Sets the name.
! * @param name The name to set
! */
! public void setName(Name name) {
! this.name = name;
! }
!
! /**
! * @hibernate.property
! * Returns the occupation.
! * @return String
! */
! public String getOccupation() {
! return occupation;
! }
!
! /**
! * Sets the occupation.
! * @param occupation The occupation to set
! */
! public void setOccupation(String occupation) {
! this.occupation = occupation;
! }
!
! }
--- 1 ----
! package test.hibernate21;
/**
* @author Administrator
*
* @hibernate.joined-subclass
* table="HUMANS"
* dynamic-update="true"
* @hibernate.joined-subclass-key
* column="ANIMAL_ID"
*/
public class Human extends Animal {
private Name name;
private String occupation;
private Component1 component1;
private Component2 component2;
/**
* Constructor for Human.
*/
public Human() {
super();
}
/**
* @hibernate.component
* Returns the name.
* @return Name
*/
public Name getName() {
return name;
}
/**
* Sets the name.
* @param name The name to set
*/
public void setName(Name name) {
this.name = name;
}
/**
* @hibernate.component
* @return
*/
public Component1 getComponent1() {
return component1;
}
public void setComponent1(Component1 component1) {
this.component1 = component1;
}
/**
* @hibernate.property
* Returns the occupation.
* @return String
*/
public String getOccupation() {
return occupation;
}
/**
* Sets the occupation.
* @param occupation The occupation to set
*/
public void setOccupation(String occupation) {
this.occupation = occupation;
}
/**
* @hibernate.component
* @return Returns the component2.
*/
public Component2 getComponent2() {
return component2;
}
/**
* @param component2 The component2 to set.
*/
public void setComponent2(Component2 component2) {
this.component2 = component2;
}
}
\ No newline at end of file
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
xdoclet-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel