1. TO Raist:

I just made the modification, no and much to my dismay, it's not working unfortunately.


  | /**
  |  *  @author [EMAIL PROTECTED]
  |  *
  |  *  @ejb.bean       
  |  *                  name="GroupEJB"
  |  *                  local-jndi-name="ejb/UserGroup"
  |  *                  display-name="User Group EJB"
  |  *                  description="User Group EJB"
  |  *                  cmp-version="2.x"
  |  *                  type="CMP"
  |  *                  view-type="local"
  |  *                  schema="Group"
  |  *                  reentrant="false"
  |  *                  primkey-field="UIN"
  |  * 
  |  *  @ejb.persistence
  |  *                  table-name="GROUPS"
  |  * 
  |  *  @ejb.finder
  |  *                  query="SELECT OBJECT(g) FROM Group AS g"
  |  *                  signature="java.util.Collection findAllGroups()"
  |  * 
  |  *  @ejb.interface
  |  *                  local-class="com.aa.samples.interfaces.GroupLocal"
  |  * 
  |  *  @ejb.home
  |  *                          local-class="com.aa.samples.interfaces.GroupLocalHome"
  |  * 
  |  *  @jboss.persistence 
  |  *                  datasource="java:/jdbc/dev01"
  |  *                  datasource-mapping="mySQL"
  |  *                  create-table="false" 
  |  *                  remove-table="false"
  |  */
  | public abstract class GroupBean implements EntityBean {
  |   ...
  |   ...
  | }
  | 

I'm not sure what it is... nothing is going to the database...


2. TO darranl:

2.1 What is the structure of the jar file?
That's a long story, there's:
a. EJB jar which contains the EJB implementation as well as META-INF with ejb-jar.xml
b. client jar, which includes the interface classes
c. WAR, which contains the JSP's, the libraries (ext jars) and the client jar (b).
d. EAR, which contains the EJB jar (a) as well as the WAR file (c).

I built it with XDoclet - can I send you the stuff by email? Anyway, for your 
reference - this is part of the documentation:


  | 7. Packaging Configurations:
  |             7.1 right click project
  |             7.2 Add four archives:
  |                                     7.2.1 UserManagementEJB.jar
  |                                                             a. add folder: 
WEB-INF/classes
  |                                                                      include: 
com/aa/samples/*.class, com/aa/samples/beans/*.class, com/aa/samples/interfaces/*.class
  |                                                             b. add file: 
META-INF/ejb-jar.xml, prefix: META-INF
  |                                                             c. add file: 
META-INF/jboss.xml, prefix: META-INF
  |                                     7.2.2 UserManagementClient.jar
  |                                                             a. add folder: 
WEB-INF/classes
  |                                                                      include: 
com/aa/samples/interfaces/*.class
  |                                                             b. add file: 
META-INF/ejb-jar.xml, prefix: META-INF
  |                                                             c. add file: 
META-INF/jboss.xml, prefix: META-INF                                                   
            
  |                                     7.2.3 UserManagementWeb.war (NOTE: The name of 
this file must corresponds to that in META-INF/application.xml)
  |                                                             a. add folder: WEB-INF
  |                                                                      include: 
*.xml,*.tld
  |                                                                      prefix: 
WEB-INF
  |                                                             b. add folder: pages
  |                                                                      prefix: pages
  |                                                             c. add folder: 
WEB-INF/classes/resources (this would include the properties files)
  |                                                                      include: *.*
  |                                                                      set prefix: 
WEB-INF/classes/resources
  |                                                             d. add folder: 
WEB-INF/classes
  |                                                                      set prefix: 
WEB-INF/classes
  |                                                                      include: 
com/aa/samples/actions/*.class, com/aa/samples/forms/*.class
  |                                                             e. add folder: 
WEB-INF/lib, prefix: WEB-INF/lib
  |                                                             f. add file: 
AuthenticationManagerClient.jar, prefix: WEB-INF/lib
  |                                     7.2.4 UserManagement.ear (NOTE: The name of 
this file must corresponds to that in META-INF/application.xml)
  |                                                             a. add file: 
META-INF/application.xml, prefix: META-INF
  |                                                             b. add file: 
AuthenticationManagerEJB.jar
  |                                                             c. add file: 
AuthenticationManagerWeb.war
  | 

2.2 Does it contain the jbosscmp-jdbc.xml?
Yes, it does, once again, it's XDoclet generated. WAIT! I forgot to include it in the 
EJB jar file!! GUYS! I'm going to run this test now first!!! What a moron I am!! This 
should not be forgiven for ages to come!! 

2.3 What does the jbosscmp-jdbc.xml look like?


  | <?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 4.0//EN" 
"http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_4_0.dtd";>
  | 
  | <jbosscmp-jdbc>
  |    <defaults>
  |    </defaults>
  | 
  |    <enterprise-beans>
  |       <entity>
  |          <ejb-name>GroupEJB</ejb-name>
  |              <datasource>java:/jdbc/dev01</datasource>
  |              <datasource-mapping>mySQL</datasource-mapping>
  |          <create-table>false</create-table>
  |          <remove-table>false</remove-table>
  |          <table-name>GROUPS</table-name>
  |          <cmp-field>
  |             <field-name>UIN</field-name>
  |             <column-name>UIN</column-name>
  |         </cmp-field>
  |          <cmp-field>
  |             <field-name>name</field-name>
  |             <column-name>name</column-name>
  |         </cmp-field>
  |          <cmp-field>
  |             <field-name>description</field-name>
  |             <column-name>description</column-name>
  |         </cmp-field>
  |          <cmp-field>
  |             <field-name>isSuspended</field-name>
  |             <column-name>isSuspended</column-name>
  |         </cmp-field>
  |       </entity>
  |    </enterprise-beans>
  | </jbosscmp-jdbc>
  | 

btw, I have another BMP that use the same datasource, and I got it working:


  | public class UserBean implements EntityBean {
  | ...
  | protected static final String jdbcJNDI="java:jdbc/dev01";
  | ...
  |     public void setEntityContext(EntityContext etx) throws EJBException {
  |             try {
  |                     initEnvReources(); *** SEE NEXT METHOD ***
  |             } catch(Exception e) {
  |                     throw new EJBException(e);
  |             }
  |             
  |             this.etx=etx;
  |             BasicConfigurator.configure();
  |       logger.debug("UserBean.setEntityContext invoked");
  |     }
  | 
  |         ...
  |         ... more stuff ...
  |     ...
  | 
  |     private void initEnvReources() throws Exception {
  |             
  |             Object ref=null;
  |             Context context=null;
  |             
  |             try {
  |                     
  |                     context=new InitialContext();
  |                     dataSource=(DataSource) context.lookup(jdbcJNDI); *** IT WORKS 
ie. datasource JNDI name correct ***
  |                     
  |                     ref=(Object) context.lookup(userJNDI);
  |                             userHome = 
(UserLocalHome)PortableRemoteObject.narrow(ref, UserLocalHome.class);
  |                     ... more stuff ...
  |             } catch(Exception e) {
  |                     throw e;
  |             }
  |   ...
  |   ...
  | }
  | 

2.4 What happens if you create an entity in code first?
I'm not sure what you mean by that...

I'm going to package "jbosscmp-jdbc.xml" in my EJB jar and see if it solves the 
problem first. (IT SHOULD), and I will let you know if that was it. Thanks! Many 
thanks, really. Geez... I'm not to be forgiven heading banging on the wall hands waving

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3853091#3853091

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3853091


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to