Entity bean mapping to multiple tables.

Hello,
Is it possible to map several tables with only one BMP?
if so please send me an example (class bean)
Thanks in advance

hi,
yes, entity bean can be mapped to multiple tables provided it is bean managed entity bean.
since, container cannot prepare complex quries so that we need to rely on bean managed persistance.
Ex : Assume you have two table like X, Y
where X table having fields (int x primarykey, varchar str) and Y table having fields (varchar name primarykey, int y).
Now you should design a primary key class of your own as shown below:
public class BeanPriamkey implements java.io.Serializable
protected int x;
protected String name;
public BeanPramkey()
//initialzation part
public BeanPramkey(int x,String str)
//initialzation part
public String toString()
//return object value as string
public int hashCode()
//return an int value
public boolean equals(BeanPramkey)
public int getX()
return x;
public String getStr()
return str;
now your entity bean would be like this
public class Mybean implements EntityBean
int x,y;
String str,name;
BeanPriamkey primekey;
public BeanPrrmkey ejbCreate(int x,String name)
//fetch the rows from the tables X and Y ;
//if the rows exists int the tables create beanprimkey object with x and name and return refernce of the Beanprimkey class object
public BeanPrimkey findByPrimarykey(BeanPrimkey )
//first extract values of x and str from BeanPrimkey
and chek X and Y table for corresponding rows if exists return the reference of BeanPrimkey else return null
public void ejbStore()
BeanPrimkey prikey = (BeanPrimkey) entityContext.getPrimarykey();
int x = prikey.getX();
String st = prikey.getStr();
update X and Y tables using x and str;
public void ejbLoad()
BeanPrimkey prikey = (BeanPrimkey) entityContext.getPrimarykey();
int x = prikey.getX();
String st = prikey.getStr();
fetch the rows from X and Y tables using x and str;
and assing the row values to bean instance variables.
public void ejbPassivate()
//code for release the resources
public void ejbActivate()
//code for aquiring the resource
public void setEntityContext(EntityContext ec)
this.ec = ec;
protected EntityContext ec;

Similar Messages

  • How to mapping Entity beans to existing database tables.

    dear all
    how can i mapping Entity beans to existing database tables and not to create new table in Orion.
    thanks for any input.
    seabin

    * You define the name of the table that an Entity EJB maps to in orion-ejb-jar.xml. For eg:<entity-deployment name="MyEntityEJB" data-source="MyDS" table="MY_DB_TABLE" ...>* If you don't want to let Orion create the tables for your EJBs, have the following entry in either of the files given below:<orion-application autocreate-tables="false" ...>1) <orion-home>/j2ee/home/config/application.xml (global effect)
    2) orion-application.xml file of that particular application (application specific)
    HTH.

  • 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!

  • Star schema cannot be mapped to multiple tables

    Hello!
    I am mapping dimension in AWM.
    When I am drawing lines from the source columns to the target objects "Member". I get the message "star schema cannot be mapped to multiple tables". Sometimes I can workaround the problem by drawing the lines in a different order. But this dose not always work
    I have a dimension that have several levels and hierarchy and I always get the message "star schema cannot be mapped to multiple tables" no matter in witch order I draw the lines to "Member".
    Why do I get this message and how do I do to solve the problem?
    Best regards,
    Tina N Mörnstam

    Hi Tina:
    Is your dimension snowflaked? Are you mapping from more than one source table to the target dimension? Is the hierarchy formed over different tables?
    Hazbleydi C. Verástegui

  • Mapping Entity beans to existing database tables.

    Hi All,
    I am using the RI of the J2EE (1.3.1) server provided by SUN. While deploying an entity bean I don't want to create a table by default, I want it to map to an existing table in the database. I find no DB column/EJB field mapping facility in the deploytool.
    Is it not possible or am I missing something....
    Thx n Rgds
    Lorenzo

    Hi!
    I'm using a different J2EE server (OC4J). But got this from the J2EE RI guide.
    If you do not want the container to create the table during deployment, follow these steps:
    1. In the Application Deployment Tool, select the Entity tab of the entity bean.
    2. In the Entity tabbed pane, click Deployment Settings.
    3. In the Deployment Settings dialog box, de-select the checkbox for "Create Table on Deploy."
    HTH.

  • Should ADF Entity Object Map to Database Table or View?

    We are building a new 3-tier JClient/ADF application. We have mapped most entity objects directly to database tables. Now that we are preparing to deploy, our DBA is angry; he believes that all entity objects should be mapped to database views. The developers see this as a headache, UML can not forward/reverse changes, and now we have another layer of abstraction, which doesn't seem to serve a useful purpose. What is the best practice in a new 3-tier application?

    Hi,
    I'm still having problems but I found out why these tables are returning errors. The username I've been given by the DBA to connect to the database is CONSULTA, but this user is only for querying purposes, the actual objects reside on a differente schema, of course, which is PROD. So the line:
    "CONSULTA"."ESTADOS"@"PROD@AYADEV_LOCATION" "ESTADOS"
    raises an exception because the table ESTADOS is not located on that schema, but on PROD. If I query the table from SQL Plus with:
    SELECT *
    FROM [email protected]@AYADEV_LOCATION
    then there's no problem at all.
    Why is this? How do I instruct OWB to point to the correct schema or to avoind fully qualifying the table name?
    Please help me, I'm kind of confused here.
    Best Regards,
    --oswaldo.
    [osantos]

  • Tutorial for CMP2.0 entity bean mapping?

    Hi folks,
    I've found some decent resources on the web for most of EJB 2.0 bean creation, BUT I'm having a hard time figuring out how to map bean fields to table columns, beans to tables, and the overall bean to a particular database.
    The latter I believe is still app server specific but the former two I believe are now supposed to be standard. The only thing I've found on the java site basically said 'use a deploy tool to create the xml' - I'd rather find a tutorial that explains what the xml is so I understand it better.
    Thanks,
    mike

    actually all three things are parts of the same process, and the process is app.server/deployment tool specific
    all of such mapping information is usually placed into application server specific deployment descriptors (or dd extensions as they are sometimes called)
    look at the documentation of you app. server

  • 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

  • 4 specific entity beans or 1 general entity bean?

    Hi All,
    My question is for example for design a history concept,
    I have 4 tables with same size PK and I'm going to design history table, now my question is which way is better to do:
    1. create 4 history tables with having FK to original tables , create 4 entity beans
    2. create 1 history table without any FK, create just 1 entity bean.
    please let me know what's your suggestion?
    Thanks so much
    Mina

    Good question minag ! ...
    I suggest this model:
    If your like flexibility on your system I recommend use Entity EJB 3 inheritance strategy with discriminator value. It implies 5 entity beans mapped on 5 tables.
    A. Abstract Entity Bean: History
    B. Implementations of History: HistoryTypeA, HistoryTypeB, HistoryTypeC, HistoryTypeD.
    Your can get more info on EJB 3 Persistence Specification item 2.1.9. (ejb-3_0-fr-spec-persistence.pdf).

  • Is it possible to map the cmp fields of the entity bean with out dictionary

    Dear sirs,
    I have created the EJB project module and WEB Module. Now i have to map the CMP fields of the entity bean to the underlying table. Is it possible to map the cmp fields of the entity bean with out java dictionary? If yes how can we do that.
    I have got some error while mapping an EJB's CMP fields to the table through dictionary. I was actually intended to map 79 fields but it gives an error that more than 64 fields are not allowed while building the dictionary.
    1. Can you tell me what could be the possible reason?
    2. Is it possible to map the cmp fields of the entity bean with out java dictionary? If yes how can we do that.
    Kindly helo me,
    Sudheesh K S

    Hi,
    Sudheesh please check up if the below link helps,there are other ways of writing the persistent.xml for container managed entity bean.
    http://help.sap.com/saphelp_nw04s/helpdata/en/9b/f695f0c84acf46a4e0b31f69d8a9b7/frameset.htm, probably in the studio you cannot browse through tables not in  the java dictionary,but manually editing it may still solve the problem.
    Also here is another link that specifies the databases supported by J2EE Engine.
    http://help.sap.com/saphelp_nw04s/helpdata/en/66/a5283eeb47b40be10000000a114084/frameset.htm
    The below link shows how to specify the database vendor and datasource
    http://help.sap.com/saphelp_nw04s/helpdata/en/e1/67fc3ee241ba28e10000000a114084/frameset.htm
    Hope you are able to solve the problem.
    Do let us know if you come up with the solution.
    Regards,
    Harish
    Message was edited by: HARISH SUBRAMANIAN

  • Problems accessing tables in oracle database with ejb entity bean

    I have created a simple server application that uses an entity bean (version 2.0) for an existing table in oracle database, and a session bean that is used as an outside interface for performing operations on that table.
    after deploying the server and client application the client attempts to perform an operation with the session bean remote interface it obtained.
    The session bean uses a locale interface to communicate with the entity bean, but when it tries to use its methods (create, findByXXX) it always get the following Exception: java.sql.SQLException: ORA-00942: table or view does not exist.
    the table of course exists, and the username password I'm using has all the permissions needed for this table.
    note - I'm using the Forte enterprise edition 4.0 as developer tool.
    I'll be glad to get some help.
    Here is the full stack trace of the exception:
    javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: javax.ejb.EJBException: nested exception is: java.sql.SQLException: ORA-00942: table or view does not exist
    javax.ejb.EJBException: nested exception is: java.sql.SQLException: ORA-00942: table or view does not exist
    java.sql.SQLException: ORA-00942: table or view does not exist
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:643)
    at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:1674)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1870)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:314)
    at com.sun.ejb.persistence.SQLEngine.ejb20Finder(SQLEngine.java:226)
    at com.sun.ejb.persistence.PartitionImpl.ejbFinder(PartitionImpl.java:736)
    at com.cti2.telco.core.ejb.entity.userInfo.UserInfoEJB_PM.ejbFindByEmail(UserInfoEJB_PM.java:393)
    at com.cti2.telco.core.ejb.entity.userInfo.UserInfoEJB_PM_LocalHomeImpl.findByEmail(UserInfoEJB_PM_LocalHomeImpl.java:64)
    at com.cti2.telco.core.ejb.UserManagerEJB.authenticate(UserManagerEJB.java:77)
    at com.cti2.telco.core.ejb.UserManagerEJB.authenticate(UserManagerEJB.java:68)
    at com.cti2.telco.core.ejb.UserManagerEJB_EJBLocalObjectImpl.authenticate(UserManagerEJB_EJB
    LocalObjectImpl.java:63)
    at com.cti2.telco.core.ejb.dispatch.TelcoFacadeEJB.userLogin(TelcoFacadeEJB.java:80)
    at com.cti2.telco.core.ejb.dispatch.TelcoFacadeEJB_EJBObjectImpl.userLogin(TelcoFacadeEJB_EJBObjectImpl.java:24)
    at com.cti2.telco.core.ejb.dispatch._TelcoFacadeEJB_EJBObjectImpl_Tie._invoke(Unknown Source)
    at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(GenericPOAServerSC.java:519)
    at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(GenericPOAServerSC.java:204)
    at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAServerSC.java:112)
    at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:273)
    at com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProcessor.java:84)
    at com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.java:99)
    ...

    Well it seems like the problems has a simple explanation. The Forte assigns a default table name (<entityName>EJBTable) when creating an entity bean from an existsing table in DB (which is not the same as the one it was created from !!!). Also, for reason unknown, when you deploy these entity beans, it doesn't even create the new table under its new name (even if instructed to).
    So using the Forte we managed to use successfuly only entity beans that were created "from scretch" (when deployed their tables are created).
    Does anyone know how to change the default name the Forte uses, and make it work properly with entity beans created from an existsing table (without going over the xml's) ?

  • Mapping an object using values from multiple tables

    Is it possible to use values looked up in other tables when mapping an object?
    For example: I have three tables. In table 1, I have fields for 'cityCode' and 'stateCode'. Table 2 is a state table which contains a list of stateCodes and corresponding stateIds. Table 3 is a city table with cityCodes listed by stateId (the city code is unique within the stateId but can be duplicated under other stateIds). Table 3 also contains the cityName for the matching cityCode/stateId pair.
    I am ultimately trying to match a cityName to a cityCode. I can't figure out how to tell toplink use the stateId returned when mapping Table 1 to Table 2 via stateCode when mapping cityCode in Table 1 to Table 3.
    Any help is greatly appreciated
    --matt                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    What does your object model look like, do you have a single object with data from all three tables in it?
    <p>
    In general because the cardinality of the tables and usage does not match, I would not recommend using multiple tables to map this. Instead define a CityNameManager class that preloads and stores all of the city names for each state, (possible lazy initializing each set of cities per state). Your getCityName() method in your class would then just use this manager.
    <p>
    You could map the multiple tables but it may be difficult, and would most likely need to be read-only because I don't think you want to insert into the table2 or 3. You basically have a foreign key table1.stateCode => table2.stateCode, (table1.cityCode, table2.stateId) => (table3.cityCode, table3.stateId). You probably cannot define this in the Mapping Workbench, so would need to use the ClassDescriptor code API and an amendment method. If you can't get the foreign keys to work you can always use the descriptor multipleTableJoinExpression and define the join directly.
    <p>
    You could also define a OneToOneMapping to the CityName from your object using the cityCode and using a selectionCriteria() on your mapping to provide an expression that uses the getTable() method to join to the intermediate table.
    <p>
    <p>---
    <p>James Sutherland

  • Entity Bean Pool

    Weblogic(6.1) deployment descriptor allows configuration of entity bean pool size
    and cache size. Since calls from multiple clients to the same entity bean are
    serialized what is the benefit of having multiple instances in an entity bean
    pool?
    Thanks,
    Stefan

    Anand,
    Of course I don't talk about an extreme case of a table with one row!?, but the
    same (logical) entity bean with same primary key accessed by multiple clients.
    Each client will use findByPrimaryKey method and will get a reference to same
    entity bean mapped to the same "row" in database . My surprise was that even for
    this case there are multiple entity instances created in the pool for one row
    in the database. For multiple instances mapped to multiple rows we concluded all
    makes sense.
    thanks again,
    Stefan
    "Anand Byrappagari" <[email protected]> wrote:
    Stefan,
    I am not sure I understand your question but if you are asking why
    have
    pooling, pool of instances is a feature for all types of entity beans.
    In
    the specific case that you have where the table has only one row it has
    limited application but the general case is that you lave multiple rows
    in a
    table. For example, an Address table will in all probability have hundereds
    of addresses of customers. An application accessing this table will be
    accessing multiple address instances at any given time. So each of this
    instances should be accessable independently hence the pool makes sense
    in
    this case. I point I am trying to make is that when you define a pool
    for a
    bean (AddressBean) you are not defining the pool for one instance of
    the
    bean type(like address_1). The pool specifies the number of instances
    (address_1, address_2, ...., address_n) that can exist at any given time.
    Are you asking if the pool size is for each row? That is if pool
    size is
    set to 10, are you asking if you can have atmost 10 instances of address_1
    as opposed to 10 instances of any address? The pool and cache sizes refer
    to
    the limit on any instances and not on 1 instance.
    Even in the extreme case like the one you mention where the table
    has
    only one row, there is some utility in having multiple instances as this
    would not require serializing access to the bean - in exclusive strategy,
    once a client has locked an EJB instance, other clients are blocked from
    the
    EJB's data even if they intend only to read the persistent fields. If
    you
    set the strategy to database then multiple instances can access the data
    depending on the isolation levels you have set. Read Chapter 4 of
    "Programming Weblogic Enterprise JavaBeans" for more information.
    Hope this helps.
    -- Anand
    "Stefan" <[email protected]> wrote in message
    news:[email protected]...
    Anand,
    If we established that same databse row can be mapped to multiple entitybeans
    instances we are back to my original question: Assuming "database"concurrency
    strategy, how do you see this model useful if calls from multiple clientsare
    serialized across all these instances? I cannot point out the benefitof
    the pool
    of entity bean instances for same row since they all wait for a clientcall to
    finish before replying to another client. Where is the benefit of havingmultiple
    instances if one instance would do the same job?
    thanks,
    Stefan
    "Anand Byrappagari" <[email protected]> wrote:
    The default concurrency-strategy in weblogic 6.1 is database which
    means
    that concurrency is taken care of at the database, this model allows
    you to
    have multiple ejb object instances for the same row in the database.
    If you
    want a single instance then you can set <concurrency-strategy> element
    in
    the deployment descriptor for the ejb to Exclusive.
    -- Anand
    "Stefan" <[email protected]> wrote in message
    news:[email protected]...
    Thanks Anand,
    Sure this way it makes total sense. However I used an example whereI was
    referencing
    only one row from multiple clients. For this case using the WeblogicConsole I
    saw the number of bean instances growing. This would indicate thatsame
    row is
    mapped to multiple bean instances in the pool, which prompted my
    question.
    Stefan
    "Anand Byrappagari" <[email protected]> wrote:
    Think of entity beans as mapping to a row in a database. Access
    to
    a
    single
    row is synchronized not to all the rows. So it still makes sense
    to
    have
    multiple instances possibly mapping to multiple rows in the database.
    -- Anand
    "stefan" <[email protected]> wrote in message
    news:[email protected]...
    Weblogic(6.1) deployment descriptor allows configuration of entitybean
    pool size
    and cache size. Since calls from multiple clients to the same
    entity
    bean
    are
    serialized what is the benefit of having multiple instances in
    an
    entity
    bean
    pool?
    Thanks,
    Stefan

  • Entity bean (ejb 3.0) refactoring problem

    I didn't find a better method than regenerating an entity bean after modifying the table definition and renaming the class after deleting the old one.
    I'm not sure i can delete the old class representing the entity bean before regenerating it without any effects into the others entity beans.
    It work fine but still a little problem. The refactoring process didn't change the name of the entity bean into the select clauses into queynamed injection.

    I am facing a similar problem. Does JDeveloper 10g (10.1.3.3.0) provide an automatic process to update an Entity Bean definition when the underlying database table definition changes?
    I also noticed that for JDeveloper to create all the relationships (i.e. @OneToMany, @ManyToOne) between multiple Entity beans, I need to create all the Entity beans together in one pass using the wizard. If two entities depend on each other, and not created together, JDeveloper will not create the relationships between them. Is there a way around that?
    Thank you

  • How do I create an Entity Bean with unknown primary keys

    Hi,
    Can a good folk help me.
    I am mapping an entity bean to an oracle table for the purpose of logging . I do not need a primary key contraint on this table. How do I specify in my entity bean file descriptor not to use any field for primary key ...
    I have done this so far...
    in my ejb.xml file - I set....
    <prim-key-class>java.lang.Object</prim-key-class>
    and deleted ....
    <primkey-field>...</primkey-field>
    My table structure is .....
    CREATE TABLE FAMS_REQUEST_LOG (
    EDITEDBY VARCHAR2(20),
    OLDTRANSDATE DATE,
    REQUESTID VARCHAR2(30) NOT NULL,
    OLDQTY NUMBER(20),
    NEWQTY NUMBER(20),
    NEWTRANSDATE DATE)
    but I still get this error message on deploying...
    [#|2006-03-01T14:30:29.250+0100|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.tools.deployment|_ThreadID=19;|Total Deployment Time: 11000 msec, Total EJB Compiler Module Time: 0 msec, Portion spent EJB Compiling: 0%|#]
    [#|2006-03-01T14:30:29.265+0100|SEVERE|sun-appserver-pe8.1_02|javax.enterprise.system.tools.deployment|_ThreadID=19;|Exception occured in J2EEC Phase
    com.sun.enterprise.deployment.backend.IASDeploymentException: Fatal Error from EJB Compiler -- JDO74046: JDOCodeGenerator: Caught a MappingConversionException loading or creating mapping model for application 'fixassetenterpriseapp' module 'FixAssetEnterpriseApp-EJBModule': JDO71030: There is no column in table FAMS_REQUEST_LOG which can be used to support the servers implementation of unknown key classes.
    at com.sun.ejb.codegen.CmpCompiler.compile(CmpCompiler.java:274)
    at com.sun.ejb.codegen.IASEJBC.doCompile(IASEJBC.java:615)
    at com.sun.ejb.codegen.IASEJBC.ejbc(IASEJBC.java:563)
    at com.sun.enterprise.deployment.backend.EJBCompiler.preDeployApp(EJBCompiler.java:340)
    at com.sun.enterprise.deployment.backend.EJBCompiler.compile(EJBCompiler.java:209)
    at com.sun.enterprise.deployment.backend.AppDeployer.runEJBC(AppDeployer.java:284)
    at com.sun.enterprise.deployment.backend.AppDeployer.deploy(AppDeployer.java:176)
    at com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.java:107)
    at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:146)
    at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:71)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:633)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:188)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:520)
    at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:143)
    at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:172)
    |#]
    Dotun

    you will have to create a sequence and a trigger
    CREATE SEQUENCE <SEQUENCE NAME>
    INCREMENT BY  1
    START WITH  1
    NOCACHE
    /this sequence will guarantee that each requested number is unique
    the trigger will select from this sequence and insert the obtained value in the new record
    CREATE OR REPLACE TRIGGER <TRIGGER NAME>
    BEFORE INSERT ON <TABLE NAME>
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
        BEGIN
            select
                <SEQUENCE NAME>.nextval
            into
                :NEW.<COLUMN NAME>
            from
                dual;
        END;
    [/CODE]
    this will always take the value from the sequence, even if you already provided a value yourself
    (otherwise you will first have to test if :NEW.<column name> is null, but I wouldn't do this for a key column.
    if you need the generated key back for further processing (inserting it into a child table for example), you can use the returning clause on the insert statement
    see the oracle documentation for more information about sequences, triggers and the returning clause
    greetings
    Freek D
    I am new to Oracle and need to know how to create a table that uses an automatic incrementation on a primay key for it's default. I need the uniqueness automatically managed by the DBMS.. This activity is know as setting the Column (primary key with identity) in Ms-SQL..
    Your help would be appreciated greatly....
    Thanks....

Maybe you are looking for