Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Problems while creating Jbosscmp-jdbc.xml file using Xdoclet

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am trying to create jbosscmp-jdbc.xml file using Xdoclet. After the file is created the tags i.e. <jdbc-type>, <sql-type> and <datasource-mapping> are not coming. Similarly in ejb-jar.xml file, <cmp-field> tag is not getting generated. A quick help would be highly appreciated.
Thanks
Deependra

Here is my bean class.
//createTable="false"
//removeTable="false"
//datasourceMapping="Oracle8"
//* primkey-field="key"
package com.xx.yy.common.eb_pkgenerator;
import java.io.Serializable;
import javax.ejb.CreateException;
import javax.ejb.DuplicateKeyException;
import javax.ejb.EJBException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.FinderException;
import javax.ejb.NoSuchEntityException;
import javax.ejb.ObjectNotFoundException;
import javax.ejb.RemoveException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
/**
* Magic do not remove
*/
/**
* This entity bean class contains method implementation defined in remote interface
*
* @version 1.0
* @author Sanjeev Garg
* @ejb:bean name="PKGenerator"
* jndi-name="jndi.PKGenerator"
* type="CMP"
* @ejb.persistence table-name="primary_keys"
* @ejb:transaction type="Required"
*
* @weblogic ool max-beans-in-free-pool="20"
* initial-beans-in-free-pool="0"
* @weblogic:cache max-beans-in-cache="100"
* idle-timeout-seconds="10"
* read-timeout-seconds="15"
* @weblogic:transaction-descriptor trans-timeout-seconds="3600"
*
* @jboss ool max-beans-in-free-pool="20"
* initial-beans-in-free-pool="0"
* @jboss:cache max-beans-in-cache="100"
* idle-timeout-seconds="10"
* read-timeout-seconds="15"
* @jboss:transaction-descriptor trans-timeout-seconds="3600"
* @jboss.persistence datasource="java:/xxDS"
* datasource-mapping="Oracle8"
* create-table="False"
* remove-table="False"
* pk-constraint="True"
* table-name="primary_keys"
* preferred-relation-mapping="foreign-key"
* @jboss:cmp-field field-name="key" column-name="key"
* @jboss:cmp-field field-name="value" column-name="value"
*/
public abstract class PKGeneratorBean implements EntityBean {
/* Entity Context */
private EntityContext ctx;
/* flag to determine whether or not the bean needs to be written to storage.*/
private transient boolean isDirty;
/**
* This method sets the EntityContext for the EJB.
*
* @param EntityContext EntityContext
*/
public void setEntityContext(EntityContext ctx) {
this.ctx = ctx;
}
/**
* This method un-sets the EntityContext for the EJB.
*/
public void unsetEntityContext() {
this.ctx = null;
}
/**
* This method returns whether the EJB has been modified or not.
*
* This method must be public for the container to be able to invoke it.
*
* @return boolean isDirty
*/
public boolean isModified() {
return isDirty;
}
/**
* Sets the EJB's modified flag.
*
* @param flag Boolean modified Flag
*/
public void setModified(boolean flag) {
isDirty = flag;
}
public void ejbActivate() { }
public void ejbPassivate() { }
public void ejbLoad() { }
public void ejbStore() {
setModified(false);
}
public void ejbRemove() throws RemoveException {}
/**
* This method corresponds to the create method in the home interface
* "PKGeneratorHome.java".
* The parameter sets of the two methods are identical. When the client calls
* <code>PKGeneratorHome.create()</code>, the container
* allocates an instance of this EJB and calls
* <code>PKGeneratorBean.ejbCreate()</code>.
* <p>
* @param key the primary key.
* @param value The value of the primary key
* @exception javax.ejb.CreateException
* if there is a problem creating the bean
* @ejb.create-method
*/
public PKGeneratorPK ejbCreate(String key,long value) throws CreateException {
setKey(key);
setValue(value);
return new PKGeneratorPK(key);
}
/**
* This method is required by the EJB Specification but is not used here.
*
* @param key the primary key.
* @param value The value of the primary key
*/
public void ejbPostCreate(String key,long value) {
}
/**
* This method will get the primary key for a given table
* @ejb:interface-method view-type="both"
*/
public long getNextIdAsLong() {
setValue(getValue()+1);
return getValue();
}
/**
* This method will get the primary key for a given table
* @ejb:interface-method view-type="both"
*/
public void setNextIdAsLong(long lPK) {
setValue(lPK);
}
/**
* This method will reset the primary key for the entity
* @ejb:interface-method view-type="both"
*/
public void resetKey() {
setValue(1L);
}
/**
* @ejb.interface-method
* @ejb.pk-field
* @ejb.persistence column-name="key"
* @ejb.relation-table table-name="key"
* datasource="java:/xxDS"
* datasource-mapping="Oracle8"
* create-table="false"
* remove-table="false"
* row-locking ="true"
* @jboss:column-name="key"
* @jboss:jdbc-type VARCHAR
* @jboss:sql-type VARCHAR2(20)
*/
public abstract String getKey();
/**
* @param key The primary key in the database
* @ejb.interface-method
* @ejb.persistence column-name="key"
*/
public abstract void setKey(String key);
/**
* @ejb.interface-method
* @jboss:column-name="value"
* @jboss:jdbc-type NUMERIC
* @jboss:sql-type NUMBER
*/
public abstract long getValue();
/**
* @param value The value of the primary key in the database
* @ejb.interface-method
*/
public abstract void setValue(long value);
}
here is the jbosscmp-jdbc.xml file and ejb-jar.xml file created using xdoclet.
snippet from jbosscmp-jdbc.xml.
<entity>
<ejb-name>PKGenerator</ejb-name>
<cmp-field>
<field-name>key</field-name>
<column-name>key</column-name>
</cmp-field>
<cmp-field>
<field-name>value</field-name>
<column-name>value</column-name>
</cmp-field>
<!--
To define load groups for this entity, write a file named
jbosscmp-jdbc-load-PKGeneratorBean.xml and put it in
your mergedir. Write it according to the following DTD slice:
<!ELEMENT load-groups (load-group+)>
<!ELEMENT load-group (load-group-name, description?, field-name+)>
<!ELEMENT load-group-name (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT field-name (#PCDATA)>
<!ELEMENT eager-load-group (#PCDATA)>
<!ELEMENT lazy-load-groups (load-group-name+)>
-->
</entity>

and code snippet from ejb-jar.xml
<entity >
<description><![CDATA[This entity bean class contains method implementation defined in remote interface]]></description>
<ejb-name>PKGenerator</ejb-name>
<home>com..xx.yy.zz.PKGeneratorHome</home>
<remote>com.pindartech.clipper.common.eb_pkgenerator.PKGenerator</remote>
<ejb-class>com..xx.yy.zz.PKGeneratorBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>com.xx.yy.zz.PKGeneratorPK</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>PKGenerator</abstract-schema-name>
</entity>
 
I suggest huckleberry pie. But the only thing on the gluten free menu is this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic