CMP entity beans from tables in 9.0.3 jdev preview

I am trying to generate CMP entity beans from oracle tables using 9.0.3 jdeveloper preview. My oracle db version is 9.2. I notice that if a table has a single column primary key, no xxxPK.java file is created. However, if the primary key is multi-column an xxxPK.java file is created. Is this correct behavior? I expected an xxxPK.java file to be created regardless of the number of columns in the primary key for the table. Has anyone else noticed this? I am new to EJB so forgive my ignorance.

Comparing to JDev 902, I think this is a much better decision. Having to change beans with a single field PK to not using a custon PK class, to avoid using that class was a pain in JDev 902. There4s little benefit in using a custom class when there4s only a single field in it... some will say that it prevents having to do majot changes to your code if the PK changes in the future and add another field. But a careful database design will void this almost completely. So having JDev 903 use a java native class is a better option in this situation. At least from my personal point of view.

Similar Messages

  • Create CMP Entity Beans from Tables Wizard - Can't see any tables with DB2

    Hi,
    I'm trying to use the "Create CMP Entity Beans from Tables Wizard" to create an entity from a table in a DB2 database. The problem is, on page 2, I can't see any available tables. I have verified that the connection works (I can open the connection in the Navigator frame and I can see that table).
    Note that if I try this wizard on an Oracle database, I can see tables.
    WTF? Can someone please help?

    I second the motion. I too work in an environment with centralized data management (DBA's) that create and maintain all tables under a generic schema. This has prevented me from using the Create Entity Beans from Table feature of Jdev r3 preview.
    At least I can see that I'm not alone.
    Thanks
    When I select the "Create CMP Entity Beans from Tables Wizard," no tables or views are available to select. The JDev database connection is using an ID assigned to me.
    The tables that I am looking for were created by the DBA under his ID and are therefore in that schema. He did create Public Synonyms for them, but the tables still do not show up in the wizard.
    Is there a configuration step that I need to do to have those tables show up?
    Tables created by a DBA and then accessed by developers using a public synonym is a very common scenario and should be supported by JDeveloper (IMO).
    Thanks.
    I'm using JDev 9.0.2.8.2.

  • Problems accessing fields in a CMP entity bean from a session bean

    Hello everybody,
    I'm getting the next problem: when I try to access a field in a CMP entity bean that I have instantiated from a session bean (trhoug entitybean.getNameOfField), I get the error "the entity bean does not exist in the database".
    This entity bean is accessing a table in an external database (not the DB of the WAS), but I know that it's getting the correct data from the table, since  I check the entitybean.size() and the entitybean.findByPrimaryKey(), and I get the right information. For some reason, the only thing that it doesn't work in the entity bean are the getter/setter methods (I created them automatically after having created the entity fields).
    I access the entity bean through its local interface...
    I know it's really difficult to give an answer with so few details, but... does anybody think I forgot something important to configure??
    Thank very much in advance!!
    Isidro

    getter and setter methods for cmp-fields are abstract.
    getter and setter methods for cmr-fields are abstract.
    "John Lee" <[email protected]> wrote:
    >
    Hi:
    Which method in a CMP Entity bean should be abstract? just only SetXXX
    and
    GetXXX?
    Thanks!
    John Lee

  • EJB 3.0: CMP Entity bean from view

    Hi,
    I have created an entity bean from a database view.
    I don't have a good filed to use as id in my view. So I want to generate the id in my entity bean.
    How can I do this ?
    Thanks

    Hi,
    I didn't get your question.
    CMP is something, which can be done by hand.
    So maybe it is better, to do it manually.
    Bea has some workaround, I am sure.
    Maybe it is something with deployment descriptors, which
    have to be configured to the underlying database.
    Sorry for my stupid first answer.
    Volker.

  • CMP Entity Bean from dataBase views

    Hi forum,
    I Have to migrate an existing application to JEE (with EJB3).
    In this application there are a lot of dataBase views.
    I'm new in EJB3 and I don't know how to structure cleanly entity beans (Specially when it are created from dataBase views).
    My problem is that for each query made from the same dataBase view I almost have to create a new entity bean with a different @Id.
    What can I do to to avoid it?
    I had thought to genrate a new @Id (attribute not persistent) but I think is not possible. It's right ?
    Someone can help me ?
    Thanks

    "CMP provides you with database independence and less coding efforts."
    BMP is not database dependent, unless you invoke database specific things in your SQL (something I do not do). CMP on the otherhand is inherently appserver specific (which was it's goal when BEA, IBM, et al. came up with it), and still limits your design possibilities. See this thread for an example:
    http://forum.java.sun.com/thread.jsp?forum=13&thread=318785
    As for less coding effort, that is a relative statment. Yes a simple CMP bean requires less coding to develop the first time. I personally view a few lines of SQL to load and store the data as being fairly trivial. But that needs to be offset with the problems inherent in using appserver specific CMP implementations.
    As an example, try mapping WebSphere CMP to a pre-existing database without using IBM's IDE. It's an incredible pain in the ass since WebSphere does not come with a "meet-in-the-middle" solution. Any J2EE developer that has had the experience of working with different appservers (especially if they have had to port an app, as I have) can attest to the complications that arise with each implementation.
    A BMP bean, written with non-DB-specific SQL, is the most portable, most flexible approach to EntityBeans. Yes, it requires the developer to be able to write some SQL, which should not take a significant amout of time. WRT queries, you have to write them, either SQL, EQL, or some appserver specific format.
    As an aside, the use of code generators to simplify the creation of EJBs lends itself well to BMP. By using a (or writing your own) code generator, you can mitigate the annoying SQL bugs that creep up early in development.

  • Help with exception calling cmp entity bean from session bean

    Hi,
    I know someone else posted a very similar problem recently but I think the root of my problem may be different.
    This is the exception that I receive:
    javax.transaction.TransactionRolledbackException: CORBA TRANSACTION_ROLLEDBACK 9998 Maybe; nested exception is:
    org.omg.CORBA.TRANSACTION_ROLLEDBACK: vmcid: 0x2000 minor code: 1806 completed: Maybe
    at com.sun.corba.ee.internal.iiop.ShutdownUtilDelegate.mapSystemException(ShutdownUtilDelegate.java:114)
    at javax.rmi.CORBA.Util.mapSystemException(Util.java:65)
    at itsthes.security._SecurityManager_Stub.findUserRoles(Unknown Source)
    at itsthes.security._SecurityManager_Stub.findUserRoles(Unknown Source)
    at itsthes.security.servlets.SecurityUserListView.processRequest(SecurityUserListView.java:80)
    at itsthes.security.servlets.SecurityUserListView.doGet(SecurityUserListView.java:94)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
    at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
    at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
    at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
    Caused by: org.omg.CORBA.TRANSACTION_ROLLEDBACK: vmcid: 0x2000 minor code: 1806 completed: Maybe
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
    at java.lang.Class.newInstance0(Class.java:306)
    at java.lang.Class.newInstance(Class.java:259)
    at com.sun.corba.ee.internal.iiop.messages.ReplyMessage_1_2.getSystemException(ReplyMessage_1_2.java:94)
    at com.sun.corba.ee.internal.iiop.LocalClientResponseImpl.getSystemException(LocalClientResponseImpl.java:120)
    at com.sun.corba.ee.internal.POA.GenericPOAClientSC.invoke(GenericPOAClientSC.java:133)
    at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:457)
    at itsthes.security._SecurityManager_Stub.findUserRoles(Unknown Source)
    ... 17 more
    This is my primary key implementation:
    public final class SecurityUserKey implements java.io.Serializable {
    public java.lang.Integer userId;
    public java.lang.Integer roleId;
    public java.lang.String emailAddress;
         * Creates an empty key for Entity Bean: SecurityUser
         public SecurityUserKey() {
    * @see java.lang.Object#equals(java.lang.Object)
    public boolean equals(java.lang.Object otherOb) {
    if (this == otherOb) {
    return true;
    if (!(otherOb instanceof itsthes.security.entitybeans.SecurityUserKey)) {
    return false;
    itsthes.security.entitybeans.SecurityUserKey other = (itsthes.security.entitybeans.SecurityUserKey) otherOb;
    return (
    (userId==null?other.userId==null:userId.equals(other.userId))
    (roleId==null?other.roleId==null:roleId.equals(other.roleId))
    (emailAddress==null?other.emailAddress==null:emailAddress.equals(other.emailAddress))
    * @see java.lang.Object#hashCode()
    public int hashCode() {
    return (
    (userId==null?0:userId.hashCode())
    ^
    (roleId==null?0:roleId.hashCode())
    ^
    (emailAddress==null?0:emailAddress.hashCode())
    My entity method invocation is this:
    public Collection findUserRoles() {
    Vector userCollection=new Vector();
    try {
    Context jndiContext = new InitialContext();
    LocalSecurityUserHome home = (LocalSecurityUserHome) jndiContext.lookup(this.securityUserBean);
    Iterator i = home.findAll().iterator();
    while ( i.hasNext() ) {
    LocalSecurityUser securityUser = (LocalSecurityUser)i.next();
    SecurityUser sessionBean=mapLocalSecurityUser(securityUser);
    userCollection.add(sessionBean);
    } catch (javax.naming.NamingException e) {
    System.err.println(e);
    } catch (javax.ejb.FinderException e) {
    System.err.println(e);
    return userCollection;
    If anyone could point me in the right direction that would be great.
    thanks,
    William

    Hi,
    The Transaction Rollback exception may be due to the SystemException thrown in your findUserRoles() code which force the container to rollback the transaction. catch the generic exception in your findUserRoles() code and veriy what went wrong.
    i hope this helps.
    -ram

  • CMP Beans from Tables: Why does the Container try to create new tables?

    I'm trying to develop an EJB application using JDeveloper on 9iAS. I have several CMPs and have my tables that I want my CMPs to be based on already defined in my DB schema. I want to use CMP but I don't want the Container to create the tables, rather I want the Container to map my CMP EJBs to the already existing tables.
    The issue is:
    While creating these CMP EJBs in JDeveloper I chose the "New Enterprise Java Bean" EJB creation wizard using the option labeled "Container-managed Entity Beans from Tables". My assumption is that this does what I want, because the wizard prompts for a schema and table you want to map to. Then it creates the attributes & getter/setter methods, PK class, etc. all based on the table defintion automatically. Great. So why when I try to run my application do I get error messages for each EJB such as:
    Auto-creating table: create table STREET_TYPE (PK_STYP_ID NUMBER(8), STREET_TYPE VARCHAR2(20), primary key (PK_STYP_ID, STREET_TYPE))
    Warning: Error creating table: ORA-00955: name is already used by an existing object
    Huh?? I thought the idea is that the CMP EJB is mapped to the existing table in my schema. Why is the Container trying to create new tables?? Is this possible? Or am I missing something fundamental about how Containers create and manage CMPs? Or is this just a JDevelop container issue? TIA

    I presume you are getting the problem on application
    deploy? This happens when upon initialization of the application using the built-in OC4J container/app server that is part of JDeveloper. Here is the full messaging:
    [Starting OC4J using the following ports: HTTP=8989, RMI=23892, JMS=9228.]
    C:\OraHome1\jdk\bin\javaw.exe -ojvm -classpath C:\OraHome1\j2ee\home\oc4j.jar com.evermind.server.OC4JServer -config C:\OraHome1\jdev\system\oc4j-config\server.xml
    [waiting for the server to complete its initialization...]
    Copying default deployment descriptor from archive at Q:\CBTCOF\COF_APPLICATION\COF_Project\classes/META-INF/orion-ejb-jar.xml to deployment directory C:\OraHome1\jdev\system\oc4j-config\application-deployments\current-workspace-app\classes...
    Auto-deploying file:/Q:/CBTCOF/COF_APPLICATION/COF_Project/classes/ (No previous deployment found)...
    Auto-creating table: create table STREET_TYPE (PK_STYP_ID NUMBER(8), STREET_TYPE VARCHAR2(20), primary key (PK_STYP_ID, STREET_TYPE))
    Warning: Error creating table: ORA-00955: name is already used by an existing object
    [...OTHER SIMILAR ERROR MESSAGES]
    done.
    Oracle9iAS (9.0.2.0.0) Containers for J2EE initialized
    If so, in the application.xml file of you
    OC4J instance the is a setting autocreate-tables,
    which by default is true!
    Set it to false as below and that should clear up
    your problem.
    <orion-application autocreate-tables="false"
    default-data-Hmm. I found at least a dozen or so files with that name and set everyone that had this attriute to "false", restarted the OC4J server and still got these errors.

  • 10.1.3.2 Does not handle Entity 3.0 beans from Tables like 10.1.3.1

    In 10.1.3.1 I was running the J2EE tutorial with the SR demo application . When you generate an entity bean from the Tables ServiceRequest and ServiceHistories you get two beans one for each and they have @OneToMany and @join meta data. The same process in 10.1.3.2 only creates one bean at a time and the @join and @OneToMany columns are not created.
    Has anyone tried this. 10.1.3.2 seems broken for entity beans from tables.

    Seems to work fine for me.
    I'm not sure I understand the remark "10.1.3.2 only creates one bean at a time" - do you mean you had to go through the wizard twice?
    I just chose both tables in step 1 of the wizard and the two beans were created with the relationship defined between them.

  • Removing a CMP Entity Bean

    I'm trying to remove a CMP Entity Bean from my project but after I do this the application becomes useless. When I start the application afterwards I get such a warning:
    "TopLink found problems in toplink-ejb-jar. Please ensure that there are corrected before deployment"
    After that, at runtime, there are lots of DescriptorExceptions, IntegrityExceptions and NullPointerExceptions. When I added the bean once more I get a bunch of compilation errors because of multiple declarations of the bean methods. I removed the bean once again, closed JDeveloper and removed all reference to that bean within the project (grep). Despite that I am unable to get rid of the aforementioned errors. What should I do?

    I'm trying to remove a CMP Entity Bean from my project but after I do this the application becomes useless. When I start the application afterwards I get such a warning:
    "TopLink found problems in toplink-ejb-jar. Please ensure that there are corrected before deployment"
    After that, at runtime, there are lots of DescriptorExceptions, IntegrityExceptions and NullPointerExceptions. When I added the bean once more I get a bunch of compilation errors because of multiple declarations of the bean methods. I removed the bean once again, closed JDeveloper and removed all reference to that bean within the project (grep). Despite that I am unable to get rid of the aforementioned errors. What should I do?

  • How to load the existing data from the databse in the CMP entity bean?

    hello
    my problem is as follows--
    i am creating a CMP entity bean.in these beans client create the data instances using create() function.
    now a entity bean will be created for the newly created data and it's EJBObject will also be formed.
    now we will be able to perform finder methods over them.
    remember these data has been newly created in the database.
    but now if i want to perform the finder methods on the
    existing data in the database( i don't need to use create() fn as i am not "creating" the data.). how will i perform the query over the existing data.
    basically i have to make a CMP bean to extract the data corresponding to a particular condition , from the database table. i don't want to create the data in the database but just find out what data satisfies my condition.
    thanking you
    Prashant

    you have to use findByXXX methods. depending on your appserver you may have to declare them (and eventually the query you want to be used) in the vendor specific deploiement descriptor.
    (e.g. using jboss i don't remember having explicitly declare the findBySomeField method - where someField is a persistent field - in the dd, whereas with bas all finder methods have to be explicitly declared)
    [note that obviously these methods have to be present in your home interface]

  • Calling stored procedures from CMP entity beans

    Hello all,
    Is it possible to call a stored procedure from a CMP entity bean? if so, what is the purpose of defining the <cmp-fields> in the descriptor file if I can just pass the result set of my query as an arraylist (or something similar), completely bypassing the need for the cmp fields? Am I missing something here?
    Please let me know.
    -Dave

    You can't call a stored procedure to populate your container managed fields. You need to use an updatable view or a table. You can create some other method in a CMP bean that calls a stored procedure however.

  • CMP Entity Beans and multiple tables

    Hi All,
    Is it possible to have a CMP Entity Bean retrieve attributes from multiple tables
    (using table join), and populate attributes from columns in both tables?
    If yes, how do we configure the same in configuration xml files.
    Is there any special handling required for this in the bean itself?
    Thanks,
    Prabh

    Hi All,
    Is it possible to have a CMP Entity Bean retrieve attributes from multiple tables
    (using table join), and populate attributes from columns in both tables?
    If yes, how do we configure the same in configuration xml files.
    Is there any special handling required for this in the bean itself?
    Thanks,
    Prabh

  • Generating an Entity Bean from a Database Table

    I am following the tutorial "How Do I: Generate an Entity Bean from a Database
    Table?" and in that process doing the "Configuring a Data Source". This is the
    message I get when I configure a data source per the tutorial and click OK. This
    data source exists and the information is correct that I have supplied.
    Do I need to put the MS jars somewhere to enable this?
    See attached file

    I've just figured it out. An input source also takes a Reader in its constructor. I was thinking that it only took an InputStream, and as the Serializer requires you to set a Writer on it, I was finding it impossible to convert between bytes and chars. Now, I have simply set a blank CharArrayWriter on the Serializer, got a char[] from it once the Serializer has written the Document to the stream, and then constructed a CharArrayReader with this char[]. It works fine now. Not that anyone read the problem anyway cos I solved it a few minutes after I posted it. Considering it first cropped up about 4 months ago and it has been niggling ever since, I am pleased!

  • Error While Deploying A CMP Entity Bean With A Composite Primary Key

    Hello all,
    I have a problem deploying CMP Entity beans with composite primary keys. I have a CMP Entity Bean, which contains a composite primary key composed of two local stubs. If you know more about this please respond to my post on the EJB forum (subject: CMP Bean Local Stub as a Field of a Primary Key Class).
    In the mean time, can you please tell me what following error message means and how to resolve it? From what I understand it might be a problem with Sun ONE AS 7, but I would like to make sure it's not me doing something wrong.
    [05/Jan/2005:12:49:03] WARNING ( 1896):      Validation error in bean CustomerSubscription: The type of non-static field customer of the key class
    test.subscription.CustomerSubscriptionCMP_1530383317_JDOState$Oid must be primitive or must implement java.io.Serializable.
         Update the type of the key class field.
         Warning: All primary key columns in primary table CustomerSubscription of the bean corresponding to the generated class test.subscription.CustomerSubscriptionCMP_1530383317_JDOState must be mapped to key fields.
         Map the following primary key columns to key fields: CustomerSubscription.CustomerEmail,CustomerSubscription.SubscriptionType. If you already have fields mapped to these columns, verify that they are key fields.Is it enough that a primary key class be serializable or all fields have to implement Serializable or be a primitive?
    Please let me know if you need more information to answer my question.
    Thanks.
    Nikola

    Hi Nikola,
    There are several problems with your CMP bean.
    1. Fields of a Primary Key Class must be a subset of CMP fields, so yes, they must be either a primitive or a Serializable type.
    2. Sun Application Server does not support Primary Key fields of an arbitrary Serializable type (i.e. those that will be stored
    as BLOB in the database), but only primitives, Java wrappers, String, and Date/Time types.
    Do you try to use stubs instead of relationships or for some other reason?
    If it's the former - look at the CMR fields.
    If it's the latter, I suggest to store these fields as regular CMP fields and use some other value as the PK. If you prefer that
    the CMP container generates the PK values, use the Unknown
    PrimaryKey feature.
    Regards,
    -marina

  • Bad Performance/OutOfMemory Error in CMP Entity Bean with Large DB

    Hello:
    I have an CMP Entity deployed on WLS 7.0
    The entity bean maps to a table that has 97,480 records.
    It has a finder: findAll() -- SELECT OBJECT(e) FROM Equipment e
    I have a JSP client that invokes the findALL()
    The performance is very poor ~ 150 seconds just to perform the findAll() - (Benchmark
    from within the JSP code)
    If more than one simultaneous call is made then I get outOfMemory Error.
    WLS is started with max memory of 512MB
    EJB is deployed with <max-beans-in-cache>100000</max-beans-in-cache>
    (without max-beans-in-cache directive the performance is worse)
    Is there any documentation available to help us in deploying CMP Entity Beans
    with very large number of records (instances) ?
    Any help is greatly appreciated.
    Regards
    Rajan

    Hi
    You should use a Select Method, it does support cursors.
    Or a Home Select Method combination.
    Regards
    Thomas
    WLS is started with max memory of 512MB
    EJB is deployed with <max-beans-in-cache>100000</max-beans-in-cache>>
    (without max-beans-in-cache directive the performance is worse)>
    Is there any documentation available to help us in deploying CMP
    Entity Beans with very large number of records (instances) ? Any help
    is greatly appreciated.>
    Regards>
    Rajan>
    >
    "Rajan Jena" <[email protected]> schrieb im Newsbeitrag
    news:3dadd7d1$[email protected]..
    >
    Hello:
    I have an CMP Entity deployed on WLS 7.0
    The entity bean maps to a table that has 97,480 records.
    It has a finder: findAll() -- SELECT OBJECT(e) FROM Equipment e
    I have a JSP client that invokes the findALL()
    The performance is very poor ~ 150 seconds just to perform the findAll() -(Benchmark
    from within the JSP code)
    If more than one simultaneous call is made then I get outOfMemory Error.
    WLS is started with max memory of 512MB
    EJB is deployed with <max-beans-in-cache>100000</max-beans-in-cache>
    (without max-beans-in-cache directive the performance is worse)
    Is there any documentation available to help us in deploying CMP EntityBeans
    with very large number of records (instances) ?
    Any help is greatly appreciated.
    Regards
    Rajan

Maybe you are looking for

  • Printer control in smartform

    I'm trying to use a command in a smartform to set a printer control. What I do is: - I choose the node containing the text I want to alter. In this case it's the MAIN window. - I right-click on it and I select create->flow logic->command - In the gen

  • Installing Chrome via GPO

    Hi! I've been working on trying to install Chrome to all Domain Computers via GPO by following this link and cannot figure out what I've been doing wrong but it's not installing on any machine. Can someone tell me if something is missing from these i

  • Color running on right side of entire paper

    why are all of my documents that im printing have color running on the entire document from top to bottom.  i used the icon on the printer to perform a cleaning and the color still running on the entire paper

  • Fax support for MacBook Pro retina

    Where can I get fax support for my MacBook Pro?

  • Need a query for export table data .....

    Hi, I need a query for exporting the data in a table to a file. Can anyone help me ? Thanking You Jeneesh