/**
* @hibernate.class table="TAAttrDef" discriminator-value="0"
* @hibernate.discriminator column="attribType" type="int"
*/
public class TAAttrDef implements Serializable, Comparable, Cloneable
{
///////////////////////////////////////
// attributes
public TAAttrDef()
{
}
private String name = "";
private int id;
private int attribType = 0;
public static final int NORMAL_ATTRIBUTE = 0;
public static final int PASSWORD_ATTRIBUTE = 1;
public static final int ENTITLEMENT_ATTRIBUTE = 2;
public int hashCode()
{
if (name == null)
{
return 0;
}
return name.hashCode();
}
public boolean equals(Object obj)
{
if ((obj == null) || (name == null))
{
return false;
}
if (!(obj instanceof TAAttrDef))
{
return false;
}
TAAttrDef rhs = (TAAttrDef) obj;
return name.equals(rhs.getName());
}
public int compareTo(Object obj)
{
if ((obj == null) || (name == null))
{
return -1;
}
if (!(obj instanceof TAAttrDef))
{
return -1;
}
TAAttrDef rhs = (TAAttrDef) obj;
return name.compareTo(rhs.getName());
}
/**
* Does ...
*
* @hibernate.property column="name" type="string" length="64" not-null="false" unique="true"
* @return
*/
public String getName()
{
return name;
} // end getName
/**
* Does ...
*
*
* @param _name
*/
public void setName(String _name)
{
name = _name;
} // end setName
/**
* Does ...
*
* @hibernate.id column="id" type="int"
* generator-class="com.trulogica.truaccess.idgen.util.HibernateIdGenerator"
* unsaved-value="0"
* @hibernate.generator-param name="TableName" value="TAAttrDef"
* @return
*/
public int getId()
{
return id;
} // end getId
/**
* Does ...
*
*
* @param _id
*/
public void setId(int _id)
{
id = _id;
} // end setId
/**
* Does ... */
public int getAttribType()
{
return attribType;
} // end getAttribType
/**
* Does ...
*
*
* @param _attribType
*/
public void setAttribType(int _attribType)
{
attribType = _attribType;
} // end setAttribType
} // end TAAttrDef
/**
* * @hibernate.subclass name="com.trulogica.truaccess.attribute.model.TAEntitlementAttr" discriminator-value="2"
*/
public class TAEntitlementAttr extends TAAttrDef implements java.io.Serializable {
public TAEntitlementAttr() {
super();
setAttribType(TAAttrDef.ENTITLEMENT_ATTRIBUTE);
}
} // end TAEntitlementAttr
public class TAPasswdAttr extends TAAttrDef implements java.io.Serializable {
public TAPasswdAttr() {
super();
setAttribType(TAAttrDef.PASSWORD_ATTRIBUTE);
}
} // end TAPasswdAttr
Then i have the stmt
q = session.createSQLQuery("SELECT {c.*} from TAAttrDef {c} where name LIKE :name","c",TAAttrDef.class );
with the intention to get all instance of TAAttrDef (TAPasswordDef, TAEnt....). I don't get TAPasswordDef or TAEnt !!!
Can somebody point out the reason. There should be a way out to get all sub classes.
|