Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-20-2008, 04:36 PM
Member
 
Join Date: May 2008
Posts: 1
kriskras is on a distinguished road
Bean data not mapped to database
Hi all,

I am building a web application that calls entity beans through a session bean. For example:

Code:
try { a1 = home.create(new Date().getTime(), 1, leverancierID, productID, hoeveelheid); } catch (Exception e) { System.err.println("Kan order niet aanmaken: " + e); System.exit(2); }
I actually never get an error, everything compiles fine but nonetheless the data never gets inserted into the HSQL database tables. So, I thought something might be wrong with the descriptors. I checked and re-checked everything but the data does not get mapped to the database. It simply doesn't get inserted. It's a mystery.

Here are my descriptors (I actually have three beans but none insert data. Hereby I give an example for the bean called OrderBean)

HTML Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <ejb-jar 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" version="2.1"> <description>Deployment descriptor for the bestellingsadministratie JOnAS example</description> <display-name>bestellingsadministratie example</display-name> <enterprise-beans> <entity> <description>Deployment descriptor for the Order bean with CMP2</description> <ejb-name>OrderBean</ejb-name> <home>org.colruyt.bestellingsadministratie.beans.order.OrderHome</home> <remote>org.colruyt.bestellingsadministratie.beans.order.Order</remote> <local-home>org.colruyt.bestellingsadministratie.beans.order.OrderLocalHome</local-home> <local>org.colruyt.bestellingsadministratie.beans.order.OrderLocal</local> <ejb-class>org.colruyt.bestellingsadministratie.beans.order.OrderBean</ejb-class> <persistence-type>Container</persistence-type> <prim-key-class>java.lang.Integer</prim-key-class> <reentrant>false</reentrant> <cmp-version>2.x</cmp-version> <abstract-schema-name>order</abstract-schema-name> <cmp-field> <field-name>orderid</field-name> </cmp-field> <cmp-field> <field-name>orderdatum</field-name> </cmp-field> <cmp-field> <field-name>orderstatusid</field-name> </cmp-field> <cmp-field> <field-name>leverancierid</field-name> </cmp-field> <cmp-field> <field-name>productid</field-name> </cmp-field> <cmp-field> <field-name>besteldehoeveelheid</field-name> </cmp-field> <primkey-field>orderid</primkey-field> <query> <query-method> <method-name>findByNumber</method-name> <method-params> <method-param>int</method-param> </method-params> </query-method> <ejb-ql>SELECT OBJECT(o) FROM order o WHERE o.orderid = ?1</ejb-ql> </query> <query> <query-method> <method-name>findAllOrders</method-name> <method-params/> </query-method> <ejb-ql>SELECT OBJECT(o) FROM order o</ejb-ql> </query> </entity> <session> <ejb-name>BestellingsadministratieSession</ejb-name> <home>org.colruyt.bestellingsadministratie.beans.session.BestellingsadministratieSessionHome</home> <remote>org.colruyt.bestellingsadministratie.beans.session.BestellingsadministratieSession</remote> <ejb-class>org.colruyt.bestellingsadministratie.beans.session.BestellingsadministratieSessionBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> </session> </enterprise-beans> <assembly-descriptor> <container-transaction> <method> <ejb-name>OrderBean</ejb-name> <method-name>*</method-name> </method> <method> <ejb-name>LeverancierBean</ejb-name> <method-name>*</method-name> </method> <method> <ejb-name>ProductBean</ejb-name> <method-name>*</method-name> </method> <method> <ejb-name>BestellingsadministratieSession</ejb-name> <method-name>*</method-name> </method> <trans-attribute>Required</trans-attribute> </container-transaction> </assembly-descriptor> </ejb-jar>
And my web application server specific (I use JOnAS) descriptor

HTML Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <jonas-ejb-jar xmlns="http://www.objectweb.org/jonas/ns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.objectweb.org/jonas/ns http://www.objectweb.org/jonas/ns/jonas-ejb-jar_4_0.xsd" > <jonas-entity> <ejb-name>OrderBean</ejb-name> <jndi-name>OrderBean</jndi-name> <jdbc-mapping> <jndi-name>jdbc_1</jndi-name> </jdbc-mapping> </jonas-entity> <jonas-session> <ejb-name>BestellingsadministratieSession</ejb-name> <jndi-name>BestellingsadministratieSessionHome</jndi-name> </jonas-session> </jonas-ejb-jar>
One last thing I'd like to mention: I based my code upon an example and all my fields in the DB table end with "_". If this is really a problem, why are there no errors then?

I really don't know what I should do. Could you guys please help me?
Thank you so much!
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-19-2008, 10:13 AM
Member
 
Join Date: Mar 2008
Posts: 27
linuxswan is on a distinguished road
What about the connection pool i.e for the database have you created the Datasource. i.e which you mentioned in the jonas-ejb-jar.xml

<jdbc-mapping>
<jndi-name>jdbc_1</jndi-name>
</jdbc-mapping>


what is the status of this --- jdbc_1

have you created the connection pool or this is from the odbc settings.

if you are creating the connection pool you can try one more rdbms xml file.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Bean Generator 2.1.4 Java Tip Java Announcements 0 04-15-2008 07:55 PM
how to get the data from hashmap into bean in struts framework java_arc Advanced Java 0 04-07-2008 08:54 PM
[SOLVED] Getting Data from a database AJG New To Java 8 04-04-2008 01:52 PM
How to query data from database using SSL mano New To Java 0 08-02-2007 06:30 PM
Database Bean Generator 2.1.2 JavaBean Java Announcements 1 07-17-2007 01:48 PM


All times are GMT +3. The time now is 01:14 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org