Aapo Laakkonen wrote:
Where should I put Xdoclet tags, in interface or concrete implementation class?
Here is example (user interface):
package com.fchaps.model;
/** * The User * * @hibernate.class table="usr" * mutable="true" * proxy="com.fchaps.model.User" */ public interface User {
/** * User identifier * * @hibernate.id column="usr_id" * unsaved-value="null" * generator-class="native" * * @return */ public Long getId(); public void setId(Long id);
/** * User's username * * @hibernate.property column="username" * not-null="true" * unique="true" * * @return */ public String getUsername(); public void setUsername(String username);
/** * User's password * * @hibernate.property column="password" * not-null="true" * unique="false" * * @return */ public String getPassword(); public void setPassword(String password);
/** * User's type (the rights level) * * @hibernate.property column="type" * not-null="false" * unique="false" * * @return */ public UserType getType(); public void setType(UserType type);
/** * If user is also a player then this is the player object for him * * @hibernate.many-to-one column="player_id" * cascade="save-update" * class="com.fchaps.model.Player" * outer-join="auto" * unique="false" * * @return */ public Player getPlayer(); public void setPlayer(Player player);
/** * User's disabled status * * @hibernate.property column="disabled" * not-null="false" * unique="false" * * @return */ public Boolean isDisabled(); public void setDisabled(Boolean disabled);
}
As you see everything is written in interface. Does this work? I have read the persisting classes should implement default constructor. That is not possible here as I'm using interface. So this doesn't work? Or does it?
If not then:
I could put these tags in concrete implementation class. Another question raises. Should I then write many-to-one tags like this:
/** * If user is also a player then this is the player object for him * * @hibernate.many-to-one column="player_id" * cascade="save-update" * class="com.fchaps.model.Player" * outer-join="auto" * unique="false" * * @return */
Or like this:
/** * If user is also a player then this is the player object for him * * @hibernate.many-to-one column="player_id" * cascade="save-update" * class="com.fchaps.model.impl.PlayerImpl" * outer-join="auto" * unique="false" * * @return */
And is it ok to return interface (like the player in above interface)? And should I specify proxy class as interface or implementation?
Next question:
If I cannot write Xdoclet tags in interface, then can this be changed to allow @hibernate.class tag to get class attribute where I could tell the implementing class? For example like this:
/** * The User * * @hibernate.class class="com.fchaps.model.impl.UserImpl" * table="usr" * mutable="true" * proxy="com.fchaps.model.User" */
Would this solve the problem I'm trying to tell?
Thanks!
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel