Update of /cvsroot/xdoclet/xdoclet/samples/src/java/test/hibernate20
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10053/samples/src/java/test/hibernate20
Added Files:
Pet.java CompositeIdEntity.java Persistent.java
WorkRequestError.java ImportedProduct.java Updateable.java
Query.java Contraband.java Human.java OIDObject.java
Address.java ICompositeId.java CompositeId.java Error.java
Lizard.java Product.java Reptile.java Animal.java
LineItem.java Name.java Order.java
Log Message:
separate samples branches for different hibernate versions
--- NEW FILE: Pet.java ---
package test.hibernate20;
/**
* @author Administrator
*
* @hibernate.subclass
* table="PETS"
* discriminator-value="pet"
*/
public class Pet extends Product {
private Animal animal;
/**
* Constructor for Pet.
*/
public Pet() {
super();
}
/**
* @hibernate.one-to-one
* @return Animal
*/
public Animal getAnimal() {
return animal;
}
/**
* Sets the animal.
* @param animal The animal to set
*/
public void setAnimal(Animal animal) {
this.animal = animal;
}
}
--- NEW FILE: CompositeIdEntity.java ---
package test.hibernate20;
/**
* demonstrate composite ID referenced by interface
*
* @author ko5tik ( Konstantin Pribluda )
* @hibernate.class
*/
public class CompositeIdEntity
{
private ICompositeId _id;
private String _foo;
/**
* @hibernate.id generator-class="assigned"
type="test.hibernate20.CompositeId"
*/
public ICompositeId getId() {
return _id;
}
public void setId(ICompositeId id) {
_id = id;
}
public String getFoo() {
return _foo;
}
/**
* foo value
*
* @return String
* @hibernate.property
*/
public void setFoo(String foo) {
_foo = foo;
}
}
--- NEW FILE: Persistent.java ---
package test.hibernate20;
import java.util.Date;
/**
* @author Administrator
*/
public abstract class Persistent {
private Long id;
private int version;
private Date created;
/**
* Constructor for Persistent.
*/
public Persistent() {
super();
}
/**
* @hibernate.id
* unsaved-value="null"
* generator-class="sequence"
* @hibernate.generator-param
* name="table"
* value="HIVAL"
* @hibernate.generator-param
* name="column"
* value="NEXT"
* @return Long
*/
public Long getId() {
return id;
}
/**
* Sets the id.
* @param id The id to set
*/
public void setId(Long id) {
this.id = id;
}
/**
* @hibernate.version
* @return int
*/
public int getVersion() {
return version;
}
/**
* Sets the version.
* @param version The version to set
*/
public void setVersion(int version) {
this.version = version;
}
/**
* @hibernate.property
* update="false"
* insert="true"
* type="timestamp"
* Returns the created.
* @return Date
*/
public Date getCreated() {
return created;
}
/**
* Sets the created.
* @param created The created to set
*/
public void setCreated(Date created) {
this.created = created;
}
}
--- NEW FILE: WorkRequestError.java ---
package test.hibernate20;
/**
* @hibernate.joined-subclass table="workreqerror"
* @hibernate.joined-subclass-key column="oid"
*
*/
public class WorkRequestError extends Error
{
protected String workRequest;
/**
* @hibernate.many-to-one column="workrequestoid"
*
* @return
*/
public String getWorkRequest()
{
return this.workRequest;
}
public void setWorkRequest(String wreq)
{
this.workRequest = wreq;
}
}
--- NEW FILE: ImportedProduct.java ---
package test.hibernate20;
import java.util.Locale;
/**
* @author Administrator
*
* @hibernate.subclass
* discriminator-value="imported"
* dynamic-update="true"
* dynamic-insert="true"
* select-before-update="false"
*/
public class ImportedProduct extends Product {
private String origin;
private Locale locale;
/**
* Constructor for ImportedProduct.
*/
public ImportedProduct() {
super();
}
/**
* @hibernate.property
* not-null="true"
* Returns the origin.
* @return String
*/
public String getOrigin() {
return origin;
}
/**
* Sets the origin.
* @param origin The origin to set
*/
public void setOrigin(String origin) {
this.origin = origin;
}
/**
* @hibernate.property
* @return Locale
*/
public Locale getLocale() {
return locale;
}
/**
* Sets the locale.
* @param locale The locale to set
*/
public void setLocale(Locale locale) {
this.locale = locale;
}
}
--- NEW FILE: Updateable.java ---
package test.hibernate20;
public interface Updateable {
/**
* @hibernate.property
* column="LAST_UPDATED_BY"
*/
public String getUpdateComment();
}
--- NEW FILE: Query.java ---
package test.hibernate20;
import java.util.Calendar;
import java.util.List;
/**
* @hibernate.query name="myNamedQuery"
* query = "from myClass where myProperty = 'X'"
*/
public class Query extends Persistent implements Updateable {
private List items;
private Human customer;
private Calendar date;
private String updateComment;
/**
* Constructor for Order.
*/
public Query() {
super();
}
public List getItems() {
return items;
}
public void setItems(List items) {
this.items = items;
}
public Calendar getDate() {
return date;
}
public void setDate(Calendar date) {
this.date = date;
}
public Human getCustomer() {
return customer;
}
public void setCustomer(Human customer) {
this.customer = customer;
}
public String getUpdateComment() {
return updateComment;
}
public void setUpdateComment(String string) {
updateComment = string;
}
}
--- NEW FILE: Contraband.java ---
package test.hibernate20;
/**
* @author Administrator
*
* @hibernate.subclass
* discriminator-value="contraband"
*/
public class Contraband extends ImportedProduct {
/**
* Constructor for Contraband.
*/
public Contraband() {
super();
}
}
--- NEW FILE: Human.java ---
package test.hibernate20;
/**
* @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;
}
}
--- NEW FILE: OIDObject.java ---
package test.hibernate20;
/**
* @hibernate.class
*/
public class OIDObject
{
protected Long OID;
public void setOID(Long oid)
{
OID = oid;
}
/**
* @hibernate.id
* column="oid"
* generator-class="sequence"
*
* @hibernate.generator-param
* name="sequence"
* value="SequenceName"
* @return
*/
public Long getOID()
{
return OID;
}
}
--- NEW FILE: Address.java ---
package test.hibernate20;
import java.util.Date;
/**
* This class is used to test generating Struts Forms
* using <actionform> as well as one-to-one validation
* mappings
*
* @author Matt Raible
*
* @struts.form name="cityForm"
* extends="org.apache.struts.validator.ValidatorForm"
* @struts.form name="stateForm"
*/
public class Address {
private String city;
private String state;
private Boolean usCitizen;
private Date startDate;
/**
* @struts.form-field form-name="cityForm"
* Returns the city.
* @return String
*/
public String getCity() {
return city;
}
/**
* @return String
* @struts.form-field form-name="stateForm"
*/
public String getState() {
return state;
}
/**
* Sets the city.
* @param city The city to set
*/
public void setCity(String first) {
this.city = first;
}
/**
* Sets the state.
* @param state The state to set
*/
public void setState(String last) {
this.state = last;
}
/**
* @struts.form-field
* @struts.validator type="required"
*/
public Boolean getUsCitizen() {
return usCitizen;
}
/**
* @spring.validator type="required"
* @return
*/
public void setUsCitizen(Boolean citizen) {
this.usCitizen = citizen;
}
/**
* @return Returns the startDate.
*/
public Date getStartDate() {
return startDate;
}
/**
* @param startDate The startDate to set.
* @spring.validator type="required"
*/
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
}
--- NEW FILE: ICompositeId.java ---
/*
* Copyright (c) 2001, 2005 The XDoclet team
* All rights reserved.
*/
package test.hibernate20;
public interface ICompositeId
{
public Integer getFoo();
public long getBar();
public String getBaz();
public Order getOrder();
public void setFoo(Integer foo);
public void setBar(long bar);
public void setBaz(String baz);
public void setOrder(Order order);
}
--- NEW FILE: CompositeId.java ---
/*
* Copyright (c) 2001, 2002 The XDoclet team
* All rights reserved.
*/
package test.hibernate20;
import java.io.Serializable;
/**
* composite ID class example
*
* @created January 6, 2003
*/
public class CompositeId implements Serializable, ICompositeId
{
/**
*/
Integer _foo;
/**
*/
long _bar;
/**
*/
String _baz;
/**
*/
Order _order;
/**
* @return
* @hibernate.property
*/
public Integer getFoo()
{
return _foo;
}
/**
* @return
* @hibernate.property
*/
public long getBar()
{
return _bar;
}
/**
* @return
* @hibernate.property
*/
public String getBaz()
{
return _baz;
}
/**
* @return
* @hibernate.many-to-one
*/
public Order getOrder()
{
return _order;
}
/**
* @param foo
*/
public void setFoo(Integer foo)
{
_foo = foo;
}
/**
* @param bar
*/
public void setBar(long bar)
{
_bar = bar;
}
/**
* @param baz
*/
public void setBaz(String baz)
{
_baz = baz;
}
/**
* @param order
*/
public void setOrder(Order order)
{
_order = order;
}
/**
* @param o
* @return
*/
public boolean equals(Object o)
{
if (o == null) {
return false;
}
if (getClass().equals(o.getClass()) &&
_foo.equals(((CompositeId) o).getFoo()) &&
_bar == ((CompositeId) o).getBar() &&
_baz.equals(((CompositeId) o).getBaz())
) {
return true;
}
else {
return false;
}
}
public int hashCode()
{
return _baz.hashCode();
}
}
--- NEW FILE: Error.java ---
package test.hibernate20;
/**
*
* @hibernate.class table="error"
*
*/
public class Error extends OIDObject
{
protected String message;
protected String description;
protected String errorMode;
protected String type;
/**
* @hibernate.property
* column="error_message"
* not-null="true"
*
*/
public String getMessage()
{
return message;
}
public void setMessage(String m)
{
message = m;
}
/**
* @hibernate.property
* column="description"
*
*/
public String getDescription()
{
return description;
}
public void setDescription(String desc)
{
description = desc;
}
/**
* @hibernate.property
* column="errormode"
* not-null="true"
*
*/
public String getErrorMode()
{
return errorMode;
}
public void setErrorMode(String errorMode)
{
this.errorMode = errorMode;
}
/**
* @hibernate.property
* column="error_type"
* not-null="true"
*
*/
public String getType()
{
return type;
}
public void setType(String newType)
{
type = newType;
}
}
--- NEW FILE: Lizard.java ---
package test.hibernate20;
/**
* @author Administrator
*
* @hibernate.joined-subclass
* table="LIZARDS"
* @hibernate.joined-subclass-key
* column="ANIMAL_ID"
*/
public class Lizard extends Reptile {
private float bodyTemperature;
/**
* Constructor for Lizard.
*/
public Lizard() {
super();
}
/**
* @hibernate.property
* not-null="true"
* @return float
*/
public float getBodyTemperature() {
return bodyTemperature;
}
/**
* Sets the bodyTemperature.
* @param bodyTemperature The bodyTemperature to set
*/
public void setBodyTemperature(float bodyTemperature) {
this.bodyTemperature = bodyTemperature;
}
}
--- NEW FILE: Product.java ---
package test.hibernate20;
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;
}
}
--- NEW FILE: Reptile.java ---
package test.hibernate20;
/**
* @hibernate.joined-subclass
* table="REPTILES"
* @hibernate.joined-subclass-key
* column="ANIMAL_ID"
*/
public abstract class Reptile extends Animal {
}
--- NEW FILE: Animal.java ---
package test.hibernate20;
import java.util.Set;
/**
* @author Administrator
*
* @hibernate.class
* table="ANIMALS"
* dynamic-update="true"
*
* @hibernate.discriminator column="disc"
* not-null="true"
* force="false"
*/
public class Animal extends Persistent {
private Set prey;
private char sex;
/**
* Constructor for Animal.
*/
public Animal() {
super();
}
/**
* @hibernate.set
* lazy="true"
* table="PREDATOR_PREY"
* order-by="PREY_ID"
* @hibernate.collection-key
* column="PREDATOR_ID"
* @hibernate.collection-many-to-many
* column="PREY_ID"
* @return Set
*/
public Set getPrey() {
return prey;
}
/**
* Sets the prey.
* @param prey The prey to set
*/
public void setPrey(Set prey) {
this.prey = prey;
}
/**
* @hibernate.property
* not-null="true"
* Returns the sex.
* @return char
*/
public char getSex() {
return sex;
}
/**
* Sets the sex.
* @param sex The sex to set
*/
public void setSex(char sex) {
this.sex = sex;
}
}
--- NEW FILE: LineItem.java ---
package test.hibernate20;
/**
* @hibernate.class
* table="ITEMS"
* mutable="false"
* schema="SHOP"
* proxy="LineItem"
*
* @author Administrator
*
*/
public class LineItem extends Persistent {
private Order order;
private Product product;
private int quantity;
/**
* Constructor for LineItem.
*/
public LineItem() {
super();
}
/**
* @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() {
return order;
}
/**
* Sets the order.
* @param order The order to set
*/
public void setOrder(Order order) {
this.order = order;
}
/**
* @hibernate.property
* column="AMOUNT"
* not-null="true"
* unique="false"
* Returns the quantity.
* @return int
*/
public int getQuantity() {
return quantity;
}
/**
* Sets the quantity.
* @param quantity The quantity to set
*/
public void setQuantity(int quantity) {
this.quantity = quantity;
}
/**
* @hibernate.many-to-one
* column="PRODUCT_ID"
* outer-join="true"
* not-null="true"
* @return Product
*/
public Product getProduct() {
return product;
}
/**
* Sets the product.
* @param product The product to set
*/
public void setProduct(Product product) {
this.product = product;
}
}
--- NEW FILE: Name.java ---
package test.hibernate20;
/**
* @author Administrator
* @struts.form include-all="true"
* extends="org.apache.struts.validator.ValidatorForm"
*/
public class Name {
private String first;
private char initial;
private String last;
private Address address;
/**
* @hibernate.property
* column="FIRST_NAME"
* Returns the first.
* @return String
*/
public String getFirst() {
return first;
}
/**
* @hibernate.property
* @hibernate.column
* name="INITIAL"
* sql-type="VARCHAR(1)"
* not-null="true"
* Returns the initial.
* @return char
*/
public char getInitial() {
return initial;
}
/**
* @hibernate.property
* column="LIST_NAME"
* @return String
*/
public String getLast() {
return last;
}
/**
* Sets the first.
* @param first The first to set
*/
public void setFirst(String first) {
this.first = first;
}
/**
* Sets the initial.
* @param initial The initial to set
*/
public void setInitial(char initial) {
this.initial = initial;
}
/**
* Sets the last.
* @param last The last to set
*/
public void setLast(String last) {
this.last = last;
}
/**
* For testing generated nested validation rules.
* @struts.validator
* @return
*/
public Address getAddress() {
return address;
}
/**
* For testing generated nested validation rules.
* @spring.validator
* @return
*/
public void setAddress(Address address) {
this.address = address;
}
}
--- NEW FILE: Order.java ---
package test.hibernate20;
import java.util.Calendar;
import java.util.List;
/**
* @author Administrator
*
* @hibernate.jcs-cache
* usage="read-write"
* @hibernate.class
* table="ORDERS"
* polymorphism="explicit"
* mutable="false"
*/
public class Order extends Persistent implements Updateable {
private List items;
private Human customer;
private Calendar date;
private String updateComment;
/**
* Constructor for Order.
*/
public Order() {
super();
}
/**
* @hibernate.list
* lazy="true"
* inverse="true"
* cascade="all"
* @hibernate.jcs-cache
* usage="read-write"
* @hibernate.collection-key
* column="ORDER_ID"
* @hibernate.collection-index
* column="ORDER_POS"
* @hibernate.collection-one-to-many
* class="test.hibernate20.LineItem"
* @return List
*/
public List getItems() {
return items;
}
/**
* Sets the items.
* @param items The items to set
*/
public void setItems(List items) {
this.items = items;
}
/**
* @hibernate.property
* type="calendar_date"
* Returns the date.
* @return Calendar
*/
public Calendar getDate() {
return date;
}
/**
* Sets the date.
* @param date The date to set
*/
public void setDate(Calendar date) {
this.date = date;
}
/**
* @hibernate.many-to-one
* column="CUSTOMER_ID"
* not-null="true"
* @return Human
*/
public Human getCustomer() {
return customer;
}
/**
* Sets the customer.
* @param customer The customer to set
*/
public void setCustomer(Human customer) {
this.customer = customer;
}
public String getUpdateComment() {
return updateComment;
}
public void setUpdateComment(String string) {
updateComment = string;
}
}
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
xdoclet-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel