If I ADD the following xdoclet tag to the getMethod for the primary key field then everything works as expected, the primary key field is populated in the value object:
* @ejb.pk-field * @jboss.persistence * auto-increment = "true" * not-null = "true"
And also change the class level tag for pk generation to @ejb.pk class="java.lang.Object"
Don Laidlaw wrote:
I sure can ...
/** * ProductNoticeHead table simpl CMP * * @ejb.bean * type="CMP" * cmp-version="2.x" * name="ProductNoticeHead" * schema="ProductNoticeHead" * jndi-name="Fulfill/ToolNotice/ProductNoticeHead" * local-jndi-name="Fulfill/ToolNotice/ProductNoticeHeadLocal" * view-type="both" * primkey-field="productNoticeHeadID" * * @ejb.pk generate="false" * @ejb.transaction type="Required" * * @ejb.finder * signature="Collection findAll()" * query="SELECT OBJECT(o) from ProductNoticeHead o" * * @ejb.finder * signature="Collection findAllOpen()" * query="SELECT OBJECT (o) FROM ProductNoticeHead o * WHERE o.status <> 'Closed'" * * @ejb.permission unchecked="true" * @ejb.security-identity run-as = "SysAdmin" * * @ejb.persistence table-name="mmProductNoticeHead" * * @ejb.value-object name="ProductNoticeHead" match = "*" * * @jboss-net.xml-schema object-type="value" * * @jboss.read-only read-only="false" * @jboss.tuned-updates tune="true" * @jboss.create-table create="false" * @jboss.remove-table remove="false" */ public abstract class ProductNoticeHeadBean implements javax.ejb.EntityBean {
-----------------------------------------------------------------------
That is the complete class level set of tags!
I found the xdt that generates the getMethod, it is entity-value-instantiation.xdt, and the relevent section:
<XDtEjbPersistent:forAllPersistentFields valueobject="<XDtEjbValueObj:currentValueObjectMatch/>">
<XDtMethod:ifHasMethod name="<XDtMethod:setterMethod/>" parameters="<XDtMethod:methodType/>">
<XDtEjbValueObj:currentValueObjectAttribute/>.<XDtMethod:setterMethod/>( <XDtMethod:getterMethod/>() );
</XDtMethod:ifHasMethod>
</XDtEjbPersistent:forAllPersistentFields>
Does not seem to recognize the primkey-field designation as a persistent field, even though it is defined as a persistent field otherwise with the @ejb.persistence tag.
Thanks for looking Rupp.
-Don
Rupp, Heiko wrote:
Hi,
can you show the complete class level Xdoclet tags?
------------------------------------------------------------------------
*Von:* [EMAIL PROTECTED] im Auftrag von Don Laidlaw
*Gesendet:* Fr 18.06.2004 18:05
*An:* [EMAIL PROTECTED]
*Betreff:* [Xdoclet-user] Value Object PK field missing
XDoclet 1.2.1, JDK 1.4.2, WinXP
I defined a CMP bean with primkey-field="productNoticeHeadID"
In the @ejb.bean tag. The property is declared as:
/** * Get the ProductNoticeHeadID (pk field) * * @return java.lang.Integer * * @ejb.persistence column-name="ProductNoticeHeadID" * @ejb.interface-method view-type="both" */ public abstract java.lang.Integer getProductNoticeHeadID();
The CMP class generated does not populate the productNoticeHeadID property of the Value object. It specifically skips this one! Is there a specific reason why the value object would not return a value for that property? Yes, it is the primary key field, but I do need to have it populated.
Note that this is not a problem when the primkey-field is not specified and a PK class is generated. In that case the value object DOES include the property. Strange.
Any help out there?
Thanks, -Don
------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user
------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user
------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user