EJB 3.0 Entity

Hi
I have created an Entity with annotations. In my application I already have several 2.1 EJBs. For the new 3jb3.0 entity I have not defined any configuration in either ejb-jar.xml or orion-ejb-jar.xml files.
How can I make sure if the Entity is correctly deployed or not ?
Thanks in Advance.

Hello,
The beauty of annotations is that they get interpreted at run/deploy time so if you are able to deploy without any errors, you can be sure that your deployment went through correctly.
The only thing to be careful is that you need to recompile your EJB 2.1 beans with a JDK 1.5 otherwise the container "might" complain.
Hope this answers your question.
Deepak

Similar Messages

  • EJB 3.0 entity tables not getting created

    I'm trying to use EJB 3.0 and can't seem to get JDeveloper to create a table in the database for an EJB 3.0 entity.
    I'm using JDeveloper Studio Edition Version 10.1.3.1.0.3914 on WinXP SP 2, Java 1.5.0_06, with Oracle Express, running in the debugger using the embedded OC4J server.
    I have created 1 entity (Customer), 1 stateless session bean (CustomerFacade), and 1 JSF (index.jspx, which allows data entry to create a Customer entity). I'm able to input fields for a Customer instance on the index.jspx form, and transmit that to the CustomerFacadeBean to persist. The call to em.persist(entity) returns without error, however, when the transaction is committed, I get the following exception indicating that the table CUSTOMER does not exist.
    Partial Exception Trace:
    javax.faces.FacesException: #{customer.saveCustomer}: javax.faces.el.EvaluationException: javax.ejb.EJBException: An exception occurred during transaction completion: ; nested exception is:
         javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701); nested exception is: oracle.oc4j.rmi.OracleRemoteException: An exception occurred during transaction completion: ; nested exception is:
         javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    The full stack trace is at the bottom of this message if that will help.
    I want to generate the database schema from the EJB entities, and have setup persistence.xml to do so -- at least I think so.
    Following is all the relevant data. I sure hope someone can help with this. I've been struggling with various problems for days (for something that should just easily work) and I'm on a tight schedule. Please help!!
    persisence.xml:
    <?xml version="1.0" encoding="windows-1252" ?>
    <persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
    version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
    <persistence-unit name="SmashPU">
    <properties>
    <property name="toplink.logging.level" value="FINEST"/>
    <property name="toplink.ddl-generation" value="drop-and-create-tables"/>
    </properties>
    </persistence-unit>
    </persistence>
    Customer.java
    package com.toolcafe.model;
    import java.io.Serializable;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.NamedQuery;
    import javax.persistence.SequenceGenerator;
    import javax.persistence.TableGenerator;
    import javax.persistence.Version;
    @Entity
    @NamedQuery(name = "Customer.findAll", query = "select o from Customer o")
    @SequenceGenerator(name="myseq")
    public class Customer implements Serializable {
    private Integer id;
    private Integer version;
    private String firstName;
    private String lastName;
    private String emailAddr;
    public Customer() {
    @Id
    public Integer getId() {
    return id;
    public void setId(Integer id) {
    this.id = id;
    @Version
    public Integer getVersion() {
    return version;
    public void setVersion(Integer version) {
    this.version = version;
    public String getFirstName() {
    return firstName;
    public void setFirstName(String firstName) {
    this.firstName = firstName;
    public String getLastName() {
    return lastName;
    public void setLastName(String lastName) {
    this.lastName = lastName;
    public String getEmailAddr() {
    return emailAddr;
    public void setEmailAddr(String emailAddr) {
    this.emailAddr = emailAddr;
    Database Info:
    I created a schema called, "SMASH", in Oracle Express.
    he Offline Database Sources contain the Customer table, but only the ID and VERSION columns, as does the Oracle Express schema.
    Exception Trace:
    javax.faces.FacesException: #{customer.saveCustomer}: javax.faces.el.EvaluationException: javax.ejb.EJBException: An exception occurred during transaction completion: ; nested exception is:
         javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701); nested exception is: oracle.oc4j.rmi.OracleRemoteException: An exception occurred during transaction completion: ; nested exception is:
         javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)
         at javax.faces.component.UICommand.broadcast(UICommand.java:332)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:287)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:401)
         at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:367)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:336)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:196)
         at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:105)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: javax.faces.el.EvaluationException: javax.ejb.EJBException: An exception occurred during transaction completion: ; nested exception is:
         javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701); nested exception is: oracle.oc4j.rmi.OracleRemoteException: An exception occurred during transaction completion: ; nested exception is:
         javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701)
         at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:150)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
         ... 25 more
    Caused by: javax.ejb.EJBException: An exception occurred during transaction completion: ; nested exception is:
         javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701); nested exception is: oracle.oc4j.rmi.OracleRemoteException: An exception occurred during transaction completion: ; nested exception is:
         javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.EJBUtils.createEJBException(EJBUtils.java:365)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.EJBUtils.createEJBException(EJBUtils.java:356)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.AbstractEJBObject.OC4J_handleUncheckedException(AbstractEJBObject.java:396)
         at CustomerFacade_RemoteProxy_51ldkeg.persistEntity(Unknown Source)
         at form.CustomerForm.saveCustomer(CustomerForm.java:66)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)
         ... 26 more
    Caused by: oracle.oc4j.rmi.OracleRemoteException: An exception occurred during transaction completion: ; nested exception is:
         javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.EJBTransactionManager.end(EJBTransactionManager.java:141)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:57)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:87)
         ... 33 more
    Caused by: javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ApplicationServerTransaction.checkForRollbackOnlyWhileInCommit(ApplicationServerTransaction.java:582)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ApplicationServerTransaction.doCommit(ApplicationServerTransaction.java:247)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ApplicationServerTransaction.commit(ApplicationServerTransaction.java:130)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ApplicationServerTransactionManager.commit(ApplicationServerTransactionManager.java:433)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.EJBTransactionManager.end(EJBTransactionManager.java:132)
         ... 39 more
    Caused by: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701)
         at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:295)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:639)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:688)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:477)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:437)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.executeCall(AbstractSession.java:675)
         at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:213)
         at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:199)
         at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:331)
         at oracle.toplink.essentials.internal.queryframework.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:176)
         at oracle.toplink.essentials.internal.queryframework.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:192)
         at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:457)
         at oracle.toplink.essentials.queryframework.InsertObjectQuery.executeCommit(InsertObjectQuery.java:74)
         at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.performUserDefinedWrite(DatabaseQueryMechanism.java:635)
         at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.performUserDefinedInsert(DatabaseQueryMechanism.java:599)
         at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.insertObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:495)
         at oracle.toplink.essentials.queryframework.WriteObjectQuery.executeCommitWithChangeSet(WriteObjectQuery.java:130)
         at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:283)
         at oracle.toplink.essentials.queryframework.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:67)
         at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:609)
         at oracle.toplink.essentials.queryframework.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:536)
         at oracle.toplink.essentials.queryframework.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:123)
         at oracle.toplink.essentials.queryframework.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:95)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2218)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:937)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:894)
         at oracle.toplink.essentials.internal.sessions.CommitManager.commitNewObjectsForClassWithChangeSet(CommitManager.java:254)
         at oracle.toplink.essentials.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:175)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:2638)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1030)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:353)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1112)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.issueSQLbeforeCompletion(UnitOfWorkImpl.java:2428)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.issueSQLbeforeCompletion(RepeatableWriteUnitOfWork.java:177)
         at oracle.toplink.essentials.transaction.AbstractSynchronizationListener.beforeCompletion(AbstractSynchronizationListener.java:116)
         at oracle.toplink.essentials.transaction.JTASynchronizationListener.beforeCompletion(JTASynchronizationListener.java:76)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ApplicationServerTransaction.callBeforeCompletion(ApplicationServerTransaction.java:1019)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ApplicationServerTransaction.doCommit(ApplicationServerTransaction.java:246)
         ... 42 more
    Caused by: java.sql.SQLException: ORA-00942: table or view does not exist
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:633)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1161)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3001)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3074)
         at oracle.oc4j.sql.proxy.PreparedStatementBCELProxy.executeUpdate(PreparedStatementBCELProxy.java:37)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:632)
         ... 78 more

    You have to add the property toplink.ddl-generation.output-mode to your persistence.xml file, for example:
    <?xml version="1.0" encoding="windows-1252" ?>
    <persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
    version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
    <persistence-unit name="model">
    <jta-data-source>jdbc/jdm-akoDS</jta-data-source>
    <properties>
    <property name="toplink.logging.level" value="INFO"/>
    <property name="toplink.target-database" value="Oracle"/>
    <property name="toplink.ddl-generation" value="drop-and-create-tables"/>
    <property name="toplink.ddl-generation.output-mode" value="database"/>
    </properties>
    </persistence-unit>
    </persistence>

  • EJB 3.0 Entity Bean

    Hi Friends,
    I am Facing a problem in EJB 3.0 Entity Bean. I am Using Eclipse 3.3.2 and JBoss 4.2 Application Server. Im getting the error such as *"javax.naming.NameNotFoundException: EntityBean not bound"* when im trying to lookup the entity bean. Herewith i had attached the servlet code. Can anyone suggest me.
    package common;
    import java.io.IOException;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import example.BookRemote;
    public class CounterServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
    static final long serialVersionUID = 1L;
    private BookRemote hello;
         public CounterServlet() {
              super();
         protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              // TODO Auto-generated method stub
              try
         InitialContext ctx = new InitialContext();
         hello = (BookRemote) ctx.lookup("EntityBean/remote");
         hello.test();
         Integer count = 1;
         request.setAttribute("counter", count);
         request.getRequestDispatcher("result.jsp").forward(request, response);
         catch (NamingException e)
         e.printStackTrace();
         protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              // TODO Auto-generated method stub
         }

    I think the Bean haven't been registered. I had look into the jmx-console and this is the result which i have got for my sample application (EntityBean).
    java:comp namespace of the EntityBean.ear/EntityBeanWeb.war application:
    +- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
    +- env (class: org.jnp.interfaces.NamingContext)
    | +- security (class: org.jnp.interfaces.NamingContext)
    | | +- realmMapping[link -> java:/jaas/other] (class: javax.naming.LinkRef)
    | | +- subject[link -> java:/jaas/other/subject] (class: javax.naming.LinkRef)
    | | +- securityMgr[link -> java:/jaas/other] (class: javax.naming.LinkRef)
    | | +- security-domain[link -> java:/jaas/other] (class: javax.naming.LinkRef)
    Global JNDI Namespace
    +- persistence.units:ear=EntityBean.ear,unitName=CounterServlet (class: org.hibernate.impl.SessionFactoryImpl)
    +- persistence.units:ear=TaskEnitity.ear,unitName=FirstEjb3Tutorial (class: org.hibernate.impl.SessionFactoryImpl)
    +- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)
    +- jmx (class: org.jnp.interfaces.NamingContext)
    | +- invoker (class: org.jnp.interfaces.NamingContext)
    | | +- RMIAdaptor (proxy: $Proxy48 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
    | +- rmi (class: org.jnp.interfaces.NamingContext)
    | | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
    +- HTTPXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
    +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
    +- UserTransactionSessionFactory (proxy: $Proxy14 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
    +- HTTPConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
    +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
    +- TransactionSynchronizationRegistry (class: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple)
    +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
    +- OnlineSurveyTool (class: org.jnp.interfaces.NamingContext)
    | +- RegisterBean (class: org.jnp.interfaces.NamingContext)
    | | +- remote (proxy: $Proxy79 implements interface online.IRegister,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
    | +- OnlineSurveyBean (class: org.jnp.interfaces.NamingContext)
    | | +- remote (proxy: $Proxy75 implements interface online.OnlineSurveyRemote,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
    +- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
    +- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
    +- queue (class: org.jnp.interfaces.NamingContext)
    | +- A (class: org.jboss.mq.SpyQueue)
    | +- testQueue (class: org.jboss.mq.SpyQueue)
    | +- ex (class: org.jboss.mq.SpyQueue)
    | +- DLQ (class: org.jboss.mq.SpyQueue)
    | +- D (class: org.jboss.mq.SpyQueue)
    | +- C (class: org.jboss.mq.SpyQueue)
    | +- B (class: org.jboss.mq.SpyQueue)
    +- topic (class: org.jnp.interfaces.NamingContext)
    | +- testDurableTopic (class: org.jboss.mq.SpyTopic)
    | +- testTopic (class: org.jboss.mq.SpyTopic)
    | +- securedTopic (class: org.jboss.mq.SpyTopic)
    +- console (class: org.jnp.interfaces.NamingContext)
    | +- PluginManager (proxy: $Proxy49 implements interface org.jboss.console.manager.PluginManagerMBean)
    +- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
    +- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory)
    +- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
    +- persistence.units:unitName=TestServlet (class: org.hibernate.impl.SessionFactoryImpl)
    +- QueueConnectionFactory (class: org.jboss.naming.LinkRefPair)
    +- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • EJB 3.0 Entity Synchronization

    Can I synchronize an EJB 3.0 entity object with a database table?
    I ask specifically for a foreign key I added to the the table after the
    creation of the entity object.
    If I can't how can I do it manually?

    Ok, I misunderstood you. You can do it manually, something like
    // User entity
    @OneToMany(mappedBy = "user")
    private List<UserLoginAttempt> userLoginAttempts;
    // UserLoginAttempt entity
    @ManyToOne // this, by default, expects the foreign key column to be user_id (if 'id' is the name of the primary key field in User); use @JoinColumn(name = "otherName") to specify different name
    private User user;
    ....You can get some automation by creating an entity diagram (New -> Diagrams -> EJB diagram) and dropping your entities on it. Then you can create an entity relationship between them (Bidirectional * to 1).
    Pedja

  • Deployment descriptor error for an EJB 3.0 entity bean module

    Hi all,
    i'm facing an error deploying an EJB 3.0 entity bean module wrapped in an enterprise application on WebLogic 10.
    The application is composed as follows:
    WASEnterprise.ear
    |-META-INF
    |-application.xml
    |-WAS.jar
    |-META-INF
    |-persistence.xml
    In other words the application server is unable to load persistence.xml deployment descriptor and,during deployment, it throws an error message like this:
    <Error> <J2EE> <BEA-160197> <Unable to load descriptor C:\bea\user_projects\domains\base_domain\autodeploy\WASEnterprise\WAS/META-INF/persistence.xml of module WAS. The error is weblogic.descriptor.DescriptorException: Unmarshaller failed
    I suppose that the persistence.xml is correct since i can deploy the application on jboss without any problem.
    The persistence.xml deployment descriptor is:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence>
    <persistence-unit name="CNT4">
    <non-jta-data-source>cnt5ds</non-jta-data-source>
    <class>it.eni.italgas.was.db.entity.AsiDisco</class>
    <class>it.eni.italgas.was.db.entity.AsiErrori</class>
    <class>it.eni.italgas.was.db.entity.WasAsiRouting</class>
    <class>it.eni.italgas.was.db.entity.WasAsiRoutingId</class>
    <class>it.eni.italgas.was.db.entity.WasAsiSchemas</class>
    </persistence-unit>
    </persistence>
    and the application.xml deployment descriptor is:
    <?xml version="1.0" encoding="UTF-8"?>
    <application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">
    <display-name>WASEnterprise</display-name>
    <module id="myeclipse.1188512259959">
    <ejb>WAS.jar</ejb>
    </module>
    </application>
    I don't use any other weblogic specific deployment descriptor.
    Have you ever experienced such a strange behaviour? Can you suggest something to solve the problem?
    Thanks inadvance.
    Denis Maggiorotto

    Hi all,
    i'm facing an error deploying an EJB 3.0 entity bean module wrapped in an enterprise application on WebLogic 10.
    The application is composed as follows:
    WASEnterprise.ear
    |-META-INF
    |-application.xml
    |-WAS.jar
    |-META-INF
    |-persistence.xml
    In other words the application server is unable to load persistence.xml deployment descriptor and,during deployment, it throws an error message like this:
    <Error> <J2EE> <BEA-160197> <Unable to load descriptor C:\bea\user_projects\domains\base_domain\autodeploy\WASEnterprise\WAS/META-INF/persistence.xml of module WAS. The error is weblogic.descriptor.DescriptorException: Unmarshaller failed
    I suppose that the persistence.xml is correct since i can deploy the application on jboss without any problem.
    The persistence.xml deployment descriptor is:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence>
    <persistence-unit name="CNT4">
    <non-jta-data-source>cnt5ds</non-jta-data-source>
    <class>it.eni.italgas.was.db.entity.AsiDisco</class>
    <class>it.eni.italgas.was.db.entity.AsiErrori</class>
    <class>it.eni.italgas.was.db.entity.WasAsiRouting</class>
    <class>it.eni.italgas.was.db.entity.WasAsiRoutingId</class>
    <class>it.eni.italgas.was.db.entity.WasAsiSchemas</class>
    </persistence-unit>
    </persistence>
    and the application.xml deployment descriptor is:
    <?xml version="1.0" encoding="UTF-8"?>
    <application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">
    <display-name>WASEnterprise</display-name>
    <module id="myeclipse.1188512259959">
    <ejb>WAS.jar</ejb>
    </module>
    </application>
    I don't use any other weblogic specific deployment descriptor.
    Have you ever experienced such a strange behaviour? Can you suggest something to solve the problem?
    Thanks inadvance.
    Denis Maggiorotto

  • Deploying EJB 3.0 entity beans without a Datasource

    [Cross-posted from the TopLink list]
    My question: Is there any way to configure the container or persistence provider to defer trying to connect to the Datasource until I make some call that involves persistence? Or any other way to deploy an app containing entity beans without having a database configured?
    Background: I am working on a component that can be configured to run in either persistent or in-memory mode. For the persistent mode we would like to use EJB 3.0 entity beans; for the in-memory mode we would like the component to be deployable without having to have a database available.
    However in my prototype of the application, when I try to deploy to OC4J 10.1.3, as soon as the entity beans are detected the TopLink persistence provider tries to establish a connection to the db via either the configured or default DataSource. So if the db is unavailable, deployment fails. Since this is occuring at deployment, it happens regardless of whether I am actually using any persistence features or not.

    Hi,
    I'm experiencing same problems, is this a bug or an feature?

  • How a stateful session ejb  invoke an entity ejb

    i have write a stateful session ejb and an entity ejb
    i want to invoke the method of the entity ejb in the session ejb.
    Do they should in the save package,and archive to a jar package?
    Thanks:)

    the choice is yours
    It not necessary that they shoule be in the same package
    Work both ways
    You make a call to it in the same way as you call it from a client
    i.e. to say that an EJB can invoke another in the same way as a client invoke it...make the home object et.al
    Regards
    Sanjay

  • EJB 3.0 entity found within JDeveloper but not on OAS 10.1.3

    I'm tearing my hair out with this!
    Basically I have an entity bean with a primary key annotated with @Id, a stateful session bean facade which has an EntityManager injected through @Resource, and a java client in JDeveloper which calls this bean through a lookup.
    In JDeveloper 10.1.3 it works fine, no problems. I deploy the app, along with a JSP version of this client, to Oracle AS 10.1.3.0 - the deploy goes through without a problem. Whenever I try to use the JSP to test that it's working, I get a NPE in the server logs - but it only points to the compiled JSP class, and therefore not corresponding to a line in the actual JSP!
    Here is the error stack trace:
    06/10/12 12:01:51 java.lang.NullPointerException
    06/10/12 12:01:51 at usernametest.jspService(_usernametest.java:121)
    06/10/12 12:01:51 at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
    06/10/12 12:01:51 at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:416)
    06/10/12 12:01:51 at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:478)
    06/10/12 12:01:51 at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:401)
    06/10/12 12:01:51 at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    06/10/12 12:01:51 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719)
    06/10/12 12:01:51 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
    06/10/12 12:01:51 at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
    06/10/12 12:01:51 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
    06/10/12 12:01:51 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:299)
    06/10/12 12:01:51 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:187)
    06/10/12 12:01:51 at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
    06/10/12 12:01:51 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303
    06/10/12 12:01:51 at java.lang.Thread.run(Thread.java:595)
    Does this look obvious to anyone? All I am asking is a general idea to what the problem might be. I have been looking at this for 2 weeks and keep going round in circles. If anyone here has any idea that would be much appreciated.
    I will supply other code (JSP, bean) if necessary, as this isn't a Java forum ;)
    Thanks in advance
    Paul

    Hi Lonneke,
    Here is the bean class:
    import java.util.List;
    import javax.annotation.Resource;
    import javax.ejb.Stateful;
    import javax.persistence.EntityManager;
    import javax.persistence.Query;
    @Stateful(name="cart")
    public class CartBean implements CartRemote, CartLocal {
    @Resource
    protected EntityManager manager;
    public CartBean() {
    public User getUser(String username){
    User user = manager.find(User.class, username);
    return user;
    public List<Ereq> getEreqs(String username) {
    Query query = manager.createNativeQuery("SELECT p.BAAN_ACTIVITY_CODE, p.CLIENT_REF_NO, p.DELIVERY_SITE, p.EREQ_MESSAGE, p.EREQ_REF_NO, p.EREQ_STATUS, " +
    "p.LAB_REF_NO, p.ORDER_DATE, p.PROJECT_CODE, p.PURCHASED_ORDER_NUMBER, p.REQUIRED_DATE, p.USER_FULLNAME " +
    "FROM Processed_Ereq p, Ereq_User_Link e, Users u " +
    "WHERE p.ereq_ref_no = e.ereq_ref_no " +
    "AND e.user_id = u.user_id " +
    "AND u.username= '" + username + "'", Ereq.class);
    return query.getResultList();
    Here is the JSP:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ page import="sun.misc.BASE64Encoder,java.util.regex.*" %>
    <%@ page import="com.evotec.ereq.CartLocal" %>
    <%@ page import="com.evotec.ereq.User" %>
    <%@ page import="javax.naming.InitialContext" %>
    <%@ page import="java.util.List" %>
    <%@ page import="java.util.ArrayList" %>
    <%!String m_username = "pbarrett";%>
    <%!String emailAddress = "";%>
    <%
    try {
    InitialContext ctx = new InitialContext();
    //CartLocal cart = (CartLocal) session.getAttribute("Cart");
    //if (cart==null) {
    CartLocal cart = (CartLocal) ctx.lookup("java:comp/env/cart");
    //session.setAttribute("Cart", cart);
    //ereqs = cart.getEreqs(m_username);
    User user = cart.getUser(m_username);
    emailAddress = user.getEmailAddress();
    %>
    <html>
    <body>
    you are: <%= m_username %><BR>
    your email address is: <%= emailAddress %><BR>
    </body>
    </html>
    <%
    catch (NullPointerException e){
    e.printStackTrace();
    %>
    Any help is welcome
    Thanks
    Paul

  • EJB 3.0 entity beans and WebDynpro models

    Hi all,
    first off all my setup:
    WebDynpro Development Component: dcA
    EJB Module Development Component: dcB
    i wan't to create Entity Beans in dcB an use it for my model in dcA.
    My questions:
    1. Why does the "New Wizard" only offer EJB 3.0 Session and Message Beans an no Entity Beans? What is the correct way for creating Entity Beans in DevStudio?
    2. Is ist right that i have to define a public Part containing the Entity Bean to make it visible to dcA?
    Regards,
       Christian

    Hi,
    I'm experiencing same problems, is this a bug or an feature?

  • Problem creating EJB 3.0 Entity bean in JDeveloper

    Hello all,
    I trying to create my first entity bean in JDeveloper.
    JDevelper create the entity bean with the code below:
    package model;
    import java.io.Serializable;
    import javax.persistence.Entity;
    @Entity
    public class BatchSettlementT implements Serializable {
    public BatchSettlementT() {
    The problem is that JDeveloper don't find the import command import javax.persistence.Entity;
    What am I doing wrong?
    I'm using JDeveloper Studio Edition Version 10.1.3.1.0.3914.
    My libraries are:
    - TopLink
    - Oracle XML Parser 2
    - EJB 3.0
    - Toplink Essentials JPA
    - J2EE
    Thanks in advance.

    It's very strange, when I type import.javax. in my class there is no persistence package available, do you have any idea what's wrong.
    I did set the technology scope to EJB either.
    Thanks!

  • Problem with ejb 3.0 entity beans with manyToMany relationship

    Hello everyone!
    I am using struts 1.2.9 and java ee 5 sdk update 2 for my enterprise application. Besides others i have these entity beans Targetgroup.java and City.java, (i would upload file but i do not know how:)
    with manytomany relationship with join table.
    when user updates Targetgroup, by clicking on web page with checkboxes and textfields, struts dispatch action calls following method stateless bean:
    public void update(String firmId, String targetgroupId, String newGender, String newMinYearsOld, String newMaxYearsOld, String[] newCities) {
    TargetgroupPK pkForUpdate = new TargetgroupPK(targetgroupId, firmId);
    Targetgroup targetgroupForUpdate = find(pkForUpdate);
    targetgroupForUpdate.setGender(newGender);
    targetgroupForUpdate.setMinyearold(Integer.parseIn t(newMinYearsOld));
    targetgroupForUpdate.setMaxyearold(Integer.parseIn t(newMaxYearsOld));
    //pronalazenje gradva za koje je vezana ciljna grupa
    Collection<City> newCitiesCollection = new ArrayList<City>();
    for(int i = 0; i < newCities.length; i++){
    String tmp_city_name = newCities;
    City city_obj = cityFacade.find(tmp_city_name);
    newCitiesCollection.add(city_obj);
    targetgroupForUpdate.setCityidCollection(newCities Collection);
    parameter newCities represents names of cities which user checked on his update page. When the page is showen to him some cities are allready check because they were connected with Targetgruoup when it was created (targetgroup).
    this code throws following exception:
    [#|2007-07-26T12:13:36.993+0200|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.container.web|_Threa dID=16;_ThreadName=httpWorkerThread-8080-0;_RequestID=f79d9c50-86b0-4b6c-96ab-97956dfb39c1;|StandardWrapperValve[action]: Servlet.service() for servlet action threw exception
    javax.ejb.EJBException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.
    javax.transaction.RollbackException: Transaction marked for rollback.
    at
    .com.sun.enterprise.web.connector.grizzly.WorkerTh read.run(WorkerThread.java:75)
    javax.ejb.EJBException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.
    at com.sun.ejb.containers.BaseContainer.completeNewTx (BaseContainer.java:3659)
    at com.sun.ejb.containers.BaseContainer.postInvokeTx( BaseContainer.java:3431)
    at com.sun.ejb.containers.BaseContainer.postInvoke(Ba seContainer.java:1247)
    at com.sun.ejb.containers.EJBLocalObjectInvocationHan dler.invoke(EJBLocalObjectInvocationHandler.java:1 92)
    at com.sun.ejb.containers.EJBLocalObjectInvocationHan dlerDelegate.invoke(EJBLocalObjectInvocationHandle rDelegate.java:71)
    at $Proxy149.update(Unknown Source)
    at audiotel.sms.actions.backoffice.TargetgroupDispatc hAction.updateOrDelete(TargetgroupDispatchAction.j ava:132)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.struts.actions.DispatchAction.dispatchM ethod(DispatchAction.java:270)
    at org.apache.struts.actions.DispatchAction.execute(D ispatchAction.java:187)
    at org.apache.struts.action.RequestProcessor.processA ctionPerform(RequestProcessor.java:431)
    at org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:236)
    at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1196)
    at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:432)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:727)
    com.sun.enterprise.web.connector.grizzly.WorkerThr ead.run(WorkerThread.java:75)
    |#]
    exceprion is throwen ONLY when in parameter newCities are city names allready connected to Targetgroup. when NewCities contains names of
    City objects which are not connected to Targetgroup it works fine, but it's of no use for me, because user must be able to add or remove certian cities from relaionship with Targetgroup. I think it's because there are rows in join table that contain primary keys of city and targetgroup which are connected so perisistence manager cann't write them again.
    i thought it was going to figure it out by itself, and only update those rows.
    Does anyone know what is the problem and solution?
    Thanks! (forgive my spelling errors :)

    solved the problem!
    I moved code from sesion bean to struts action as follows:
    CityFacadeLocal cityFacade = lookupCityFacade();
    //prikupljanje novih podataka o ciljnoj grupi
    String newGender = ctf.getGender();
    String newMaxYears = ctf.getMaxyears();
    String newMinYears = ctf.getMinyears();
    String[] newSelectedCities = ctf.getSelectedCities();
    //niz imena gradova se prevodi u kolekcju objekata City
    Collection<City> newCitiesObjCollection = new Vector<City>();
    for(int i = 0; i < newSelectedCities.length; i++){
    String tmpCityName = newSelectedCities;
    City tmpCityObj = cityFacade.find(tmpCityName);
    newCitiesObjCollection.add(tmpCityObj);
    //setovanje novih podataka
    targetgroupForUD.setGender(newGender);
    targetgroupForUD.setMinyearold(Integer.parseInt(newMinYears));
    targetgroupForUD.setMaxyearold(Integer.parseInt(newMaxYears));
    targetgroupForUD.setCityidCollection(newCitiesObjCollection);
    //pozivanje update metdoe u session beany
    targetgroupFacade.edit(targetgroupForUD);
    //korisnik se vraca na stranu sa svim postojecim ciljnim grupama
    forward = mapping.findForward("backend.targetgroups");
    and now it works fine. I guess probelm was same transaction scope for Targetgroup and City entities. Now when they are separated it works.
    Thanks!

  • EJB 3.0 entity problem

    I'm tearing my hair out at this one.
    Using JDeveloper 10.1.3, I am generating EJB 3.0 CMP entity beans from tables. On creation from one particular table, the Column I want to use as the primary key does not get automatically annotated with @Column(name="table_name") so I add this in manually and also annotate the column with @Id.
    Whenever I try and use a value which has been mapped as a String within the OC4J container in JDeveloper, it works fine. Whenever I try and access it from within OracleAS 10.1.3, I get a null pointer - but accessing values which are mapped as Long works fine! This is the only one of the Entities I created which does this. I also get a null pointer if I try and assign the entity to a member variable.
    What I want to know is has anyone else seen this behaviour before?
    Thanks in advance
    Paul

    haha I will take that as a no then... ;)
    One other thing is that the entity in question is also causing a serialization error when being transferred from the bean to the test client when run within JDeveloper. Really really weird.
    Any clues/comments appreciated.
    Paul

  • Problems accessing ejb 3.0 entity bean from project

    I have written some code using ejb 3.0 and was previously accessing the entity bean without problem when both ejbs and the accessing code were in the same project. However I have moved the accessing code into a different project within the same application and now when the code tries to accessing the entity bean I get the following error:
    com.colwilson.web.ingestion.IdentifiedException: java.lang.ClassCastException: __Proxy3
         at com.colwilson.web.ingestion.IngestionHandler.recordArrived(IngestionHandler.java:140)
         at com.colwilson.web.ingestion.IngestionHandler.main(IngestionHandler.java:52)
    Caused by: java.lang.ClassCastException: __Proxy3
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.getFreshObject(StatelessSessionRemoteInvocationHandler.java:21)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.getReplacementObject(RecoverableRemoteInvocationHandler.java:64)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.handleRecovery(RecoverableRemoteInvocationHandler.java:41)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:30)
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
         at __Proxy1.mergeEntity(Unknown Source)
         at com.colwilson.web.ingestion.IngestionHandler.recordArrived(IngestionHandler.java:137)
         ... 1 more
    Now, of course I could move the code back into the same project, but as I understand it that is just the point of ejbs. I'm looking up the entity bean thus:
    final Context context = InitialContext();
    ingestionSessionEJB =
    (IngestionSessionEJB)context.lookup("IngestionSessionEJB");
    It may be true that I don't understand the way lookup works, but to be honest I can't find the docs that explain what I've got wrong.
    Please help.

    hi
    Double Click on the project which is goin to use the project which contains bean from the Application Navigator window. The project properties window will open. Choose the "Dependencies" item from left panel. click on the radio "User Project Settings" and select another project which contain ejb which you're goin to access...
    Best Of Luck
    Ravi A. Trivedi

  • @EJB annotation in entity bean does not work

    I just started with ejb3. I have created a couple of beans. One session bean that looks like this:
    @Stateless
    public class MySessionBean implements MySession
         @Resource(name="jdbc/mydb")
         private DataSource myDB;
    public void someMethod() {
    myDB.getConnection()
    This works great. The other bean is an entity bean, and there the resource injection doesn't work. It looks like this:
    @Entity
    public class MyEntityBean
    @Resource(name="jdbc/mydb")
         private DataSource myDB;
    public void someMethod() {
    myDB.getConnection()
    Is resource injection any different in an entity bean then in a session bean? Both beans belong to the same package and are in the same application, (ear). I have exactly the same problem with @EJB injection: it works fine in the session bean but not in the entity bean...
    Any help is appreciated...
    John

    <code>
    @Entity
    @Table(name = "assetfault")
    @NamedQueries( {@NamedQuery(name = ... )})
    public class Assetfault implements Serializable {
    @javax.ejb.EJB private com.novadent.data.assetmg.sessionbeans.AssetFacadeLocal aF;
    @javax.ejb.EJB private com.novadent.data.assetmg.sessionbeans.AssetfaultFacadeLocal afF;
    </code>
    importing javax.ejb.EJB ?

  • Merge ejb Jar containing entity beans

    Hi,
    Is there a way I can merge two or more jar files which contain Entity beans, I
    am
    deploying under WAS 6.1 and am developing under Jbuilder 6??? I am using CMP
    2 entity beans
    Thanks In Advance

    Hi.
    Try posting this to the ejb newsgroup.
    Regards,
    Michael
    jack V wrote:
    Hi,
    Is there a way I can merge two or more jar files which contain Entity beans, I
    am
    deploying under WAS 6.1 and am developing under Jbuilder 6??? I am using CMP
    2 entity beans
    Thanks In Advance--
    Michael Young
    Developer Relations Engineer
    BEA Support

Maybe you are looking for