This content has been marked as final.
Show 1 reply
-
1. Re: Help on using Jboss 4.0.2 and MySQL 4.1.13
fbiaggi Jul 28, 2005 12:56 PM (in response to pittupgd)/** * ejbCreate method for a CMP entity bean * @param argHad010 java.math.BigDecimal * @exception javax.ejb.CreateException The exception description. * @exception java.rmi.RemoteException The exception description. */ public SdhadKey ejbCreate( BigDecimal argHad010 ) throws javax.ejb.CreateException, java.rmi.RemoteException, javax.ejb.FinderException, javax.naming.NamingException { // All CMP fields should be initialized here. // check if argument BigDecimal has a valid address-number > 0 and if yes, take this if ( argHad010.longValue( ) > 0 ) { setHad010( argHad010 ); } else { //generate new address-number setHad010( new BigDecimal( getNewIntegerObjectId( getClass( ) ) ) ); } return new SdhadKey( getHad010( ) ); } <?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 version="2.0" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"> --> <ejb-jar> <description> </description> <display-name>SisaEJB_LegacyEB</display-name> <enterprise-beans> <entity id="Sdhad"> <ejb-name>Sdhad</ejb-name> <home>sisaejb.legacy.eb.sdhad.SdhadHome</home> <remote>sisaejb.legacy.eb.sdhad.Sdhad</remote> <local-home>sisaejb.legacy.eb.sdhad.SdhadLocalHome</local-home> <local>sisaejb.legacy.eb.sdhad.SdhadLocal</local> <ejb-class>sisaejb.legacy.eb.sdhad.SdhadBean</ejb-class> <persistence-type>Container</persistence-type> <prim-key-class> sisaejb.legacy.eb.sdhad.SdhadKey </prim-key-class> <reentrant>false</reentrant> <cmp-version>2.x</cmp-version> <abstract-schema-name>Sdhad</abstract-schema-name> <cmp-field id="Sdhad_had120"> <field-name>had120</field-name> </cmp-field> .... <query> <description> Converted from IBM version 1.1 extensions. </description> <query-method> <method-name>findSdhadBySearchString</method-name> <method-params> <method-param>java.lang.String</method-param> </method-params> </query-method> <ejb-ql>select object(o) from Sdhad o where o.had050 LIKE ?1 order by o.had050</ejb-ql> </query> .... <?xml version="1.0" encoding="UTF-8"?> <!-- DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.2//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd" --> <jbosscmp-jdbc> <defaults> <datasource>java:/sisaejb</datasource> <datasource-mapping>mySQL</datasource-mapping> <create-table>true</create-table> <remove-table>false</remove-table> <fk-constraint>false</fk-constraint> <entity-command name="no-select-before-insert" /> </defaults> <entity-commands> <!-- variation on default that skips select before insert --> <entity-command name="no-select-before-insert" class="org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand"> <attribute name="SQLExceptionProcessor"> jboss.jdbc:service=SQLExceptionProcessor </attribute> </entity-command> </entity-commands> <!-- variation on defaults --> <enterprise-beans> <entity> <ejb-name>Sdhad</ejb-name> <table-name>sdhad</table-name> </entity> </enterprise-beans> </jbosscmp-jdbc>