Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XDoclet and ejb-jar.xml - No Entity tags?

843829Aug 1 2003 — edited Aug 3 2003
build.xml

<?xml version="1.0" encoding="UTF-8"?>
<project name="XDoclet" default="ejbdoclet">
<property file="build.properties"/>
<target name="init">
<property name="dir" value="G:\JAVA Tools"/>
<property name="lib.dir" value="lib"/>

<!-- library/jar path -->
<property name="xdoclet.jar.path" value="${dir}\XDoclet\lib\xdoclet.jar"/>
<property name="log4j.jar.path" value="${dir}\XDoclet\samples\lib\log4j.jar"/>
<property name="ant.jar.path" value="${dir}\ANT\lib\ant.jar"/>

<property name="src.dir" value="src"/>
<property name="generated.src.dir" value="XDoclet/gen-src-code"/>
<property name="web.dir" value="${src.dir}/web"/>

<property name="generated.java.dir" value="${generated.src.dir}/java"/>
<property name="config.dir" value="config"/>
<property name="build.dir" value="XDoclet/build"/>
<property name="dist.dir" value="XDoclet/dist"/>
<property name="build.compiler" value="modern"/>

<path id="project.class.path">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
<!-- append the external classpath lastly -->
<pathelement path="${java.class.path};${log4j.jar.path}"/>
</path>
</target>

<!-- Prepare -->
<target name="prepare" depends="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.dir}/ejb"/>
<mkdir dir="${build.dir}/ejb/META-INF"/>
<mkdir dir="${build.dir}/web"/>
<mkdir dir="${build.dir}/web/WEB-INF"/>
<mkdir dir="${build.dir}/web/WEB-INF/tlds"/>
<mkdir dir="${build.dir}/web/WEB-INF/classes"/>
<mkdir dir="${build.dir}/j2ee"/>
<mkdir dir="${build.dir}/j2ee/META-INF"/>
<mkdir dir="${build.dir}/jmx"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${generated.src.dir}"/>
<mkdir dir="${generated.java.dir}"/>
<echo message="XDoclet Path = ${xdoclet.jar.path}"/>
<echo message="Log4J Path = ${log4j.jar.path}"/>
<echo message="Ant Path = ${ant.jar.path}"/>
<echo message="ClassPath = ${java.class.path}"/>
<property name="cp" refid="project.class.path"/>
<echo message="CLASSPATH/REF ID:${cp}"/>
<echo message="base dir = ${basedir}/${src.dir}"/>
</target>

<target name="delete" >
<echo message = "Deleting directories"/>
<delete dir="${build.dir}"/>
<delete dir="${build.dir}/ejb"/>
<delete dir="${build.dir}/ejb/META-INF"/>
<delete dir="${build.dir}/web"/>
<delete dir="${build.dir}/web/WEB-INF"/>
<delete dir="${build.dir}/web/WEB-INF/tlds"/>
<delete dir="${build.dir}/web/WEB-INF/classes"/>
<delete dir="${build.dir}/j2ee"/>
<delete dir="${build.dir}/j2ee/META-INF"/>
<delete dir="${build.dir}/jmx"/>
<delete dir="${dist.dir}"/>
<delete dir="${generated.src.dir}"/>
<delete dir="${generated.java.dir}"/>
</target>

<!-- Run EJBDoclet -->
<target name="ejbdoclet" depends="prepare">

<taskdef name="ejbdoclet"
classname="xdoclet.ejb.EjbDocletTask"
classpath="${java.class.path};${log4j.jar.path};${ant.jar.path};${xdoclet.jar.path} "/>

<ejbdoclet sourcepath="${src.dir}"
destdir="${generated.java.dir}"
classpathref="project.class.path"
excludedtags="@version,@author"
ejbspec="2.0"
>

<fileset dir="${src.dir}">
<include name="**/*EJB.java"/>

</fileset>

<dataobject/>
<!-- <localinterface/>
<localhomeinterface/> -->

<remoteinterface/>
<homeinterface/>
<entitypk/>
<!-- <entitycmp/> -->

<deploymentdescriptor destdir="${build.dir}/ejb/META-INF" validatexml="true"/>

<jboss version="2.4" xmlencoding="UTF-8" validatexml="true" typemapping="Hypersonic
SQL" datasource="java:/DefaultDS" destdir="${build.dir}/ejb/META-INF"/>

<!--
<weblogic xmlencoding="UTF-8" destdir="${build.dir}/ejb/META-INF" validatexml="true"/>
<webSphere destdir="${build.dir}/ejb/META-INF" />
<orion/>
<apachesoap destdir="${build.dir}/web"/>
-->

<!--
Have struts form objects generated based on entity beans'
data objects. Will require struts.jar to compile.
<strutsform />
-->
</ejbdoclet>
</target>
</project>


My Session Bean:

package com.uniserv.comn.controller.ejb.session.terminalfacade;

/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
*/


import javax.ejb.*;
import java.util.*;
import com.uniserv.comn.util.*;
import com.uniserv.comn.model.*;
import com.uniserv.comn.controller.ejb.entity.tenderconfig.*;



public class TerminalSessionFacadeEJB implements SessionBean {
private SessionContext ctx = null;
private ServiceLocator serviceLocator = null;

public TerminalSessionFacadeEJB() throws ServiceLocatorException {
try {
serviceLocator = ServiceLocator.getInstance();
} catch (Exception e) {
System.out.println("TerminalSessionFacade Exception : " + e.getMessage());
}
}

/**
* Adds an tenderConfig record
* @param tenderConfigVO TenderConfig's Value Object
* @return boolean true if successful, false if not
*/
public boolean addTenderConfig(TenderConfigVO tenderConfigVO) {
System.out.println("TerminalSessionFacadeEJB.addTenderConfig - START");
boolean blnRet = false;

try {
LocalTenderConfigHome home = (LocalTenderConfigHome)
serviceLocator.getLocalHome(ServiceLocator.Services.TENDERCONFIG);
LocalTenderConfig local = null;
try {
TenderConfigPK pk
= new TenderConfigPK(tenderConfigVO.getTndrID(), tenderConfigVO.getTndrCfgName());
local = home.findByPrimaryKey(pk);
} catch (Exception e) {
System.out.println(e.getMessage());
} finally {
if (local == null) {
home.create(tenderConfigVO);
blnRet = true;
} else {
blnRet = false;
}
}

} catch (Exception e) {
System.out.println("Error in TerminalSessionFacadeEJB.addTenderConfig "
+ "method (Exception) : "
+ e.getMessage());
} finally {
System.out.println("Returned value : " + blnRet);
System.out.println("TerminalSessionFacadeEJB.addTenderConfig - END");
return blnRet;
}
}

public void setSessionContext(SessionContext parm1) throws javax.ejb.EJBException, java.rmi.RemoteException {

this.ctx = parm1;

}

public void ejbRemove() throws javax.ejb.EJBException, java.rmi.RemoteException
{
}

public void ejbActivate() throws javax.ejb.EJBException, java.rmi.RemoteException
{
}

public void ejbPassivate() throws javax.ejb.EJBException, java.rmi.RemoteException
{
}

public void ejbCreate() throws javax.ejb.EJBException
{
}
}


My Entity Bean:
package com.uniserv.comn.controller.ejb.entity.tenderconfig;

/**
* @ejb.bean
* type="CMP"
* cmp-version="2.x"
* name="TenderConfigEJB"
* schema="TenderConfig"
* view-type="local"
*
*
*/

import javax.ejb.*;
import com.uniserv.comn.model.*;

public abstract class TenderConfigEJB implements EntityBean{
private EntityContext ctx = null;

/**
* @ejb.pk
*
*/
public abstract int getTndrID();
public abstract void setTndrID(int iTndrID);
/**
* @ejb.pk
*
*/
public abstract String getTndrCfgName();
public abstract void setTndrCfgName(String strTndrCfgName);
public abstract int getTndrType();
public abstract void setTndrType(int iTndrType);
public abstract String getTndrCfgValue();
public abstract void setTndrCfgValue(String strTndrCfgValue);
public abstract String getTndrCfgDataType();
public abstract void setTndrCfgDataType(String strTndrCfgDataType);
public abstract String getTndrCfgDesc();
public abstract void setTndrCfgDesc(String strTndrCfgDesc);


public TenderConfigVO getTenderConfigVO() {
TenderConfigVO tenderConfigVO = new TenderConfigVO();

tenderConfigVO.setTndrID(this.getTndrID());
tenderConfigVO.setTndrCfgName(this.getTndrCfgName());
tenderConfigVO.setTndrType(this.getTndrType());
tenderConfigVO.setTndrCfgValue(this.getTndrCfgValue());
tenderConfigVO.setTndrCfgDataType(this.getTndrCfgDataType());
tenderConfigVO.setTndrCfgDesc(this.getTndrCfgDesc());

return tenderConfigVO;
}

public void setTenderConfigVO(TenderConfigVO tenderConfigVO) {
this.setTndrID(tenderConfigVO.getTndrID());
this.setTndrCfgName(tenderConfigVO.getTndrCfgName());
this.setTndrType(tenderConfigVO.getTndrType());
this.setTndrCfgValue(tenderConfigVO.getTndrCfgValue());
this.setTndrCfgDataType(tenderConfigVO.getTndrCfgDataType());
this.setTndrCfgDesc(tenderConfigVO.getTndrCfgDesc());
}

/**
* Constructor
*/
public TenderConfigEJB() {
}

/**
* ejbCreate callback method
* @return int
*/
public TenderConfigPK ejbCreate(TenderConfigVO tenderConfigVO)
throws CreateException {
this.setTenderConfigVO(tenderConfigVO);
return null;
}

/**
* ejbPostCreate
* @param TerminalConfigTypeVO
*/
public void ejbPostCreate(TenderConfigVO tenderConfigVO) {
}

/**
* setEntityContext callback method
*/
public void setEntityContext(EntityContext ctx) {
this.ctx = ctx;
}

/**
* unsetEntityContext callback method
*/
public void unsetEntityContext() {
this.ctx = null;
}

/**
* ejbActivate callback method
*/
public void ejbActivate() {
}

/**
* ejbPassivate callback method
*/
public void ejbPassivate() {
}

/**
* ejbLoad callback method
*/
public void ejbLoad() {
}

/**
* ejbRemove callback method
*/
public void ejbRemove() {
}

/**
* ejbStore callback method
*/
public void ejbStore() {
}
}



But the generated ejb-jar.xml only contains

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<description>No Description.</description>
<display-name>Generated by XDoclet</display-name>
<enterprise-beans>
<!-- Session Beans -->
<session>
<description><![CDATA[No Description.]]></description>
<ejb-name>com.uniserv.comn.controller.ejb.session.terminalfacade.TerminalSessionFacade</ejb-name>
<home>com.uniserv.comn.controller.ejb.session.terminalfacade.TerminalSessionFacadeHome</home>
<remote>com.uniserv.comn.controller.ejb.session.terminalfacade.TerminalSessionFacade</remote>
<ejb-class>com.uniserv.comn.controller.ejb.session.terminalfacade.TerminalSessionFacadeEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
<!--
To add session beans that you have deployment descriptor info for, add
a file to your merge directory called session-beans.xml that contains
the <session></session> markup for those beans.
-->
<!-- Entity Beans -->
<!--
To add entity beans that you have deployment descriptor info for, add
a file to your merge directory called entity-beans.xml that contains
the <entity></entity> markup for those beans.
-->
<!-- Message Driven Beans -->
<!--
To add message driven beans that you have deployment descriptor info for, add
a file to your merge directory called message-driven-beans.xml that contains
the <message-driven></message-driven> markup for those beans.
-->
</enterprise-beans>
<!-- Relationships -->
<!-- Assembly Descriptor -->
<assembly-descriptor>
<!-- finder permissions -->
<!-- transactions -->
<!-- finder transactions -->
</assembly-descriptor>
</ejb-jar>



this ejb-jar.xml only contains entries for session beans? where did the entries for entity beans went?Ive written XDoclet tags for the Entity Bean as what ive posted above....help!!!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 31 2003
Added on Aug 1 2003
3 comments
208 views