Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within EJB and other Jakarta /Java EE Technologies
Search Coderanch
Advance search
Google search
Register / Login
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
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
Liutauras Vilda
Jeanne Boyarsky
paul wheaton
Sheriffs:
Ron McLeod
Devaka Cooray
Henry Wong
Saloon Keepers:
Tim Holloway
Stephan van Hulst
Carey Brown
Tim Moores
Mikalai Zaikin
Bartenders:
Frits Walraven
Forum:
EJB and other Jakarta /Java EE Technologies
My Entity beans are not saved (stored) on data base
Neo tnt
Greenhorn
Posts: 2
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
I work with Ejb2.1, oc4j et xdoctlet.
I have a problem with my entity beans CMP:
Context ctx = new InitialContext(properties); Object objref = ctx.lookup ("My"); home = (MyHome) PortableRemoteObject.narrow ( objref, MyHome.class ) ; home.create(BigDecimal.valueOf(5), BigDecimal.valueOf(54));
In this case my bean is created and i can manipulate it but it is not stored on data base.
if i look up for an id in the data base i got this exception
javax.ejb.ObjectNotFoundException: Exception [EJB - 10008] : bean de type [My] introuvable via la recherche [findByPrimaryKey]. at oracle.toplink.internal.ejb.cmp.EJBExceptionFactory.objectNotFound(EJBExceptionFactory.java:325) at oracle.toplink.internal.ejb.cmp.finders.Finder.checkNullResult(Finder.java:224) at oracle.toplink.internal.ejb.cmp.finders.Finder.processResults(Finder.java:214) at oracle.toplink.internal.ejb.cmp.finders.Finder.internalExecute(Finder.java:100) at oracle.toplink.internal.ejb.cmp.finders.FindByPrimaryKey.executeFindByPk(FindByPrimaryKey.java:33) at oracle.toplink.internal.ejb.cmp.finders.FinderManager.findByPrimaryKey(FinderManager.java:125)
here is the file ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?> <ejb-jar id="ejb-jar_1" 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><![CDATA[02firstentity generated by eclipse wtp xdoclet extension.]]></description> <display-name>02firstentity</display-name> <enterprise-beans> <!-- Session Beans --> <!-- To add session beans that you have deployment descriptor info for, add a file to your XDoclet merge directory called session-beans.xml that contains the <session></session> markup for those beans. --> <!-- Entity Beans --> <entity id="ContainerManagedEntity_My"> <description><![CDATA[<!-- begin-xdoclet-definition -->]]></description> <ejb-name>My</ejb-name> <home>b.MyHome</home> <remote>b.My</remote> <local-home>b.MyLocalHome</local-home> <local>b.MyLocal</local> <ejb-class>b.MyCMP</ejb-class> <persistence-type>Container</persistence-type> <prim-key-class>java.math.BigDecimal</prim-key-class> <reentrant>false</reentrant> <cmp-version>2.x</cmp-version> <abstract-schema-name>MySCHEMA</abstract-schema-name> <cmp-field id="CMPAttribute_1"> <description><![CDATA[<!-- begin-user-doc --> CMP Field a_bind Returns the a_bind]]></description> <field-name>a_bind</field-name> </cmp-field> <cmp-field id="CMPAttribute_2"> <description><![CDATA[<!-- begin-user-doc --> CMP Field c_bind Returns the c_bind]]></description> <field-name>c_bind</field-name> </cmp-field> <primkey-field>a_bind</primkey-field> <query> <query-method> <method-name>findAll</method-name> <method-params> </method-params> </query-method> <ejb-ql><![CDATA[SELECT OBJECT(a) FROM MySCHEMA as a]]></ejb-ql> </query> <!-- Write a file named ejb-finders-MyBean.xml if you want to define extra finders. --> </entity> <!-- To add entity beans that you have deployment descriptor info for, add a file to your XDoclet 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 XDoclet merge directory called message-driven-beans.xml that contains the <message-driven></message-driven> markup for those beans. --> </enterprise-beans> <!-- Relationships --> <!-- Assembly Descriptor --> <!-- To specify your own assembly descriptor info here, add a file to your XDoclet merge directory called assembly-descriptor.xml that contains the <assembly-descriptor></assembly-descriptor> markup. --> <assembly-descriptor id="AssemblyDescriptor_1"> <!-- To specify additional security-role elements, add a file in the merge directory called ejb-security-roles.xml that contains them. --> <!-- method permissions --> <!-- To specify additional method-permission elements, add a file in the merge directory called ejb-method-permissions.ent that contains them. --> <!-- transactions --> <!-- To specify additional container-transaction elements, add a file in the merge directory called ejb-container-transactions.ent that contains them. --> <!-- finder transactions --> <!-- message destinations --> <!-- To specify additional message-destination elements, add a file in the merge directory called ejb-message-destinations.ent that contains them. --> <!-- exclude list --> <!-- To specify an exclude-list element, add a file in the merge directory called ejb-exclude-list.xml that contains it. --> </assembly-descriptor> </ejb-jar>
Thanks in advance.
Neo tnt
Greenhorn
Posts: 2
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Here is what it tries to do:
1) Create a bean
2) Find it by primary key
3) Find all beans of that type by primary key
4) Remove all beans of that type by primary key
Here's what happens:
1) Bean is created
2) Bean cannot be found by primary key
3) findAll() returns a Collection of size 0
4) Nothing to remove
Now, if I try to create the bean again, I get an
exception because it's already there. But I can't find
it. So, next step:
1) Is anything is the database?
Answer: no. No database entries have been made. The
database is 100% empty.
This leads me to the conclusion that Entity bean is in
cache but not in the database and that the finders are
looking in the database.
Get off me! Here, read this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
how debug a CMP entity error?
Urgent help needed - Thanks
SAXParseException: The content of element type "enterprise-beans" is incomplete, it m
error initializing Jboss-3.2.3
error while deploying ejb in jboss
More...