Toplink JPA and handle to a sequence

Hi All,
I am trying to figure out a way to get a handle to an Oracle sequence and use it from the java application i.e. run operations like currval/nextval.
The reason I need this flexibility is to refer 2 sequences from the java app and apply it on a single table. Currently the table i am trying to insert already has a sequence which is a primary key generator. We do refer it in our JPA annotations and this works fine.
But there was a need where another column (not part of Primary key) also needs its values from a different sequence.
When we try to refer it from Toplink JPA it does not allow and errors stating cannot have 2 sequences mapping for a single table entity.
Let me know your thoughts.
Thanks

You could use a native SQL query to get the nextval or curval from the Sequence.
TopLink/EclipseLink should support an API for this, or allow multiple sequences per object, please vote for these bugs,
https://bugs.eclipse.org/bugs/show_bug.cgi?id=267701
https://bugs.eclipse.org/bugs/show_bug.cgi?id=320456
James : http://www.eclipselink.org

Similar Messages

  • Toplink-jpa and/or jdev11 problem

    Hi,
    How should I configure a toplink/jpa application in oc4j 11? Mine doesn't seem to be able to be able to connect... But I guess I didn't configure correctly.
    Anyway, it works in the jdevelopper 11 (technical preview) embedded oc4j. I can deploy it ok from jdeveloper, and even connect to the session beans on the server from another application (swing client, independant).
    But whenever my beans try to make a request, I get this exception:
    exception occurred during method invocation:
    javax.ejb.EJBTransactionRolledbackException: Exception [TOPLINK-4002] (Oracle
    TopLink - 11g Release 1 (11.1.1.0.0) (Build 070428)):
    oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: Io exception: The Network Adapter could not establish
    the connectionError Code: 17002; nested exception is: Exception [TOPLINK-4002]
    (Oracle TopLink - 11g Release 1 (11.1.1.0.0) (Build 070428)):
    I made a sample jdbc connection from the session bean, to the database it should connect to: no problem.
    Is there a checklist of what I should make sure? There are a lot of wizards, configuration files, etc. and I'm a little bit confused about the cause of the problem and how to fix it. My question has been on metalink for 48 hours, but without luck yet.
    Here is a more complete part of the stack trace:
    Caused by: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:72)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:105)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:168)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:224)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:495)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:429)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:650)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:200)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:34)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:413)
    at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:388)
    at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:278)
    at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:203)
    at oracle.oc4j.sql.DataSourceConnectionPoolDataSource.getPooledConnection(DataSourceConnectionPoolDataSource.jav
    a:57)
    at oracle.oc4j.sql.xa.EmulatedXADataSource.getXAConnection(EmulatedXADataSource.java:94)
    at oracle.oc4j.sql.spi.ManagedConnectionFactoryImpl.createXAConnection(ManagedConnectionFactoryImpl.java:251)
    at oracle.oc4j.sql.spi.ManagedConnectionFactoryImpl.createManagedConnection(ManagedConnectionFactoryImpl.java:21
    2)
    at com.evermind.server.connector.ApplicationConnectionManager.createManagedConnection(ApplicationConnectionManager.java:1354)
    at oracle.oc4j.sql.OracleConnectionFactoryAdapter.createConnection(OracleConnectionFactoryAdapter.java:110)
    at oracle.ucp.common.CollectionConnectionPoolImpl.createOnePooledConnection(Coll
    ectionConnectionPoolImpl.java:513)
    at oracle.ucp.common.CollectionConnectionPoolImpl.borrowConnectionWithoutCountingRequests(CollectionConnectionPoolImpl.java:
    419)
    at oracle.ucp.common.CollectionConnectionPoolImpl.borrowConnection(CollectionConnectionPoolImpl.java:295)
    at oracle.oc4j.sql.OracleCommonConnectionPool.borrowConnection(OracleCommonConnectionPool.java:79)
    at oracle.oc4j.sql.OracleCommonConnectionPool.getManagedConnection(OracleCommonConnectionPool.java:61)
    at oracle.j2ee.connector.OC4JConnectionPoolAdapter.getManagedConnection(OC4JConnect
    ionPoolAdapter.java:543)
    at com.evermind.server.connector.ApplicationConnectionManager.getManagedConnectionContext(ApplicationConnectionManager.java:1568)
    at com.evermind.server.connector.ApplicationConnectionManager.getConnectionFromPool
    (ApplicationConnectionManager.java:1553)
    at com.evermind.server.connector.ApplicationConnectionManager.acquireConnectionContext(ApplicationConnectionManager.ja
    va:1499)
    at com.evermind.server.connector.ApplicationConnectionManager.allocateConnection(ApplicationConnectionManager.java:1444)
    at oracle.j2ee.connector.OracleConnectionManager.unprivileged_allocateConnection(OracleConnectionManager.jav
    a:238)
    at oracle.j2ee.connector.OracleConnectionManager.allocateConnection(OracleConnectionManager.java:192)
    at oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:217)
    at oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:147)
    at oracle.toplink.jndi.JNDIConnector.connect(JNDIConnector.java:123)
    ... 69 more

    HI
    can you reply the feedback of metalink? because I'm having similar problem.
    I debug in junit and embebbed at the jdev and it works well, but when I deploy in a standalone oc4j it gives me the same error of Excepção de E/S: The Network Adapter could not establish the connection
    And I'm not using 11g, I'm still in 10g but the problem might be the same.
    cumps
    DnlCY
    null

  • Toplink JPA and Java type mapping

    Hi there,
    I'm struggling wit mapping an existing database using Toplink Essentials.
    Specifically: I have an INT SQL field which I want to map as boolean/Boolean in my entity class.
    How to do this? Either in standard JPA or with some Toplink extensions?
    Markus

    Hi Markus,
    The JPA spec doesn't cover conversion/transformation but you can do it with TopLink Essentials using a Converter. I have an example pasted below that uses a converter to map between a database VARCHAR value and a pre-Java 5 enum (i.e., a hand coded enum-type class that runs in Java 1.4).
    I use a descriptor customizer to get hold of the Basic mapping (in TopLink a "DirectToFieldMapping") and then plug in a converter.
    --Shaun
    Persistence.xml:
    <property
       name="toplink.descriptor.customizer.TypeWriter"
       value="oracle.toplink.essentials.emf.examples.library.orm.TypeWriterCustomizer"/>The customizer:
    public class TypeWriterCustomizer implements DescriptorCustomizer {
          * Add customizer to translate between Enum and value.
         public void customize(ClassDescriptor descriptor) throws Exception {
              DirectToFieldMapping typeMapping = (DirectToFieldMapping) descriptor.getMappingForAttributeName("type");
              Converter typeWriterEnumConverter = TypeWriterEnumConverter.getInstance();
              typeMapping.setConverter(typeWriterEnumConverter);
    }The actual converter class:
    * TypeWriterEnumConverter is a singleton since it has no state.
    public class TypeWriterEnumConverter implements Converter {
         protected static TypeWriterEnumConverter instance = new TypeWriterEnumConverter();
         private TypeWriterEnumConverter() {}
         public static TypeWriterEnumConverter getInstance() {
              return instance;
         public Object convertDataValueToObjectValue(Object data, Session session) {
              String typeName = (String)data;
              return TWriterType.get(typeName);
         public Object convertObjectValueToDataValue(Object object, Session session) {
              TWriterType type = (TWriterType) object;
              if (type != null) {
                   return type.getName();
              } else {
                   return null;
         public void initialize(DatabaseMapping arg0, Session arg1) {}
         public boolean isMutable() {
              return false;
    }

  • Toplink JPA with Coherence deployment to Weblogic 10.3

    Hi,
    I have created an EJB application using Toplink JPA and Coherence. I would like to deploy this application to Weblogic 10.3.
    During the startup of Weblogic I have specified the Java option as
    -Dtangosol.coherence.cacheconfig=D:/JDEV_11g/jdeveloper/jdev/mywork/CoherenceApp/CoherenceProject/src/META-INF/coherence-cache-config.xml.
    Persistence.xml and coherence-cache-config.xml are palced inside the jar file.
    When I execute the ejb client program, during the method call, I can see that coherence is started but it uses the cache-config from the coherence.jar file instaed of the value I have set during startup. How can I make weblogic use my cache-config.xml? I have included the log file entries from server:
    [EL Finest]: 2009.04.17 05:33:48.625--UnitOfWork(1777337)--Thread(Thread[[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Execute query ReadObjectQuery(coherenceproject.MetadataType)
    2009-04-17 05:33:54.547/258.954 Oracle Coherence 3.4.2/411 <Info> (thread=[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Loaded operational configuration from resource "zip:D:/JDEV_11g/jdeveloper/jdev/mywork/CoherenceApp/lib/coherence.jar!/tangosol-coherence.xml"
    2009-04-17 05:33:54.562/258.969 Oracle Coherence 3.4.2/411 <Info> (thread=[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Loaded operational overrides from resource "zip:D:/JDEV_11g/jdeveloper/jdev/mywork/CoherenceApp/lib/coherence.jar!/tangosol-coherence-override-dev.xml"
    2009-04-17 05:33:54.562/258.969 Oracle Coherence 3.4.2/411 <D5> (thread=[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Optional configuration override "/tangosol-coherence-override.xml" is not specified
    2009-04-17 05:33:54.578/258.985 Oracle Coherence 3.4.2/411 <D5> (thread=[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Optional configuration override "/custom-mbeans.xml" is not specified
    Oracle Coherence Version 3.4.2/411
    Grid Edition: Development mode
    Copyright (c) 2000-2009 Oracle. All rights reserved.
    *2009-04-17 05:33:55.750/260.157 Oracle Coherence GE 3.4.2/411 <Info> (thread=[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Loaded cache configuration from resource "zip:D:/JDEV_11g/jdeveloper/jdev/mywork/CoherenceApp/lib/coherence.jar!/coherence-cache-config.xml"*
    2009-04-17 05:34:17.390/281.797 Oracle Coherence GE 3.4.2/411 <D5> (thread=Cluster, member=n/a): Service Cluster joined the cluster with senior service member n/a
    2009-04-17 05:34:21.890/286.297 Oracle Coherence GE 3.4.2/411 <Info> (thread=Cluster, member=n/a): Created a new cluster "cluster:0x2FFB" with Member(Id=1, Timestamp=2009-04-17 05:34:09.203, Address=141.144.90.113:8088, MachineId=18289, Location=site:sg.oracle.com,machine:rajerama-sg,process:3816, Role=WeblogicServer, Edition=Grid Edition, Mode=Development, CpuCount=2, SocketCount=1) UID=0x8D905A7100000120B0D9DD3347711F98
    2009-04-17 05:34:27.000/291.407 Oracle Coherence GE 3.4.2/411 <D5> (thread=DistributedCache, member=1): Service DistributedCache joined the cluster with senior service member 1
    [EL Finer]: 2009.04.17 05:34:28.343--ServerSession(32927169)--Thread(Thread[[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Coherence(MetadataType)::Get: 2
    [EL Fine]: 2009.04.17 05:34:28.703--ServerSession(32927169)--Thread(Thread[[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Coherence(MetadataType)::Get: 2 result: null
    [EL Finer]: 2009.04.17 05:34:28.703--ServerSession(32927169)--Thread(Thread[[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Coherence(MetadataType)::Get: 2
    *[EL Fine]: 2009.04.17 05:34:28.703--ServerSession(32927169)--Thread(Thread[[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Coherence(MetadataType)::Get: 2 result: null*
    null
    Eventhough the method is called correctly, it does not return the value. Is there any other setup that has to be done?
    Regards
    Raji

    Hi Raji,
    You mentioned:
    >
    -Dtangosol.coherence.cacheconfig=D:/JDEV_11g/jdeveloper/jdev/mywork/CoherenceApp/CoherenceProject/src/META-INF/coherence-cache-config.xml
    >
    and
    >
    Persistence.xml and coherence-cache-config.xml are palced inside the jar file.
    >
    It appears that these are conflicting; as the system property indicates that the config should be read from a file, whereas the file is actually deployed in a jar.
    That being said, I would suggest double checking that the system property is actually being set in the JVM. In my testing, if I specify a cache config that does not exist, an exception will be thrown:
    java -Dtangosol.coherence.cacheconfig=foo.xml  com.tangosol.net.CacheFactory
    Oracle Coherence Version 3.4.2/411p3
    Grid Edition: Development mode
    Copyright (c) 2000-2009 Oracle. All rights reserved.
    Map (?): cache test
    2009-04-22 15:33:15.310/6.917 Oracle Coherence GE 3.4.2/411p3 <Error> (thread=main, member=1):
    (Wrapped: Failed to load the factory) java.lang.reflect.InvocationTargetException
            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:494)
            at com.tangosol.util.ClassHelper.newInstance(ClassHelper.java:662)
            at com.tangosol.net.CacheFactory.getConfigurableCacheFactory(CacheFactory.java:602)
            at com.tangosol.coherence.component.application.console.Coherence.doCache(Coherence.CDB:9)
            at com.tangosol.coherence.component.application.console.Coherence.processCommand(Coherence.CDB:209)
            at com.tangosol.coherence.component.application.console.Coherence.run(Coherence.CDB:39)
            at com.tangosol.coherence.component.application.console.Coherence.main(Coherence.CDB:3)
            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.tangosol.net.CacheFactory.main(CacheFactory.java:1308)
    Caused by: (Wrapped: Failed to load configuration resource: foo.xml) java.io.IOException: Configuration is missing: "foo.xml", loader=null
            at com.tangosol.net.DefaultConfigurableCacheFactory.loadConfigAsResource(DefaultConfigurableCacheFactory.java:386)
            at com.tangosol.net.DefaultConfigurableCacheFactory.loadConfig(DefaultConfigurableCacheFactory.java:337)
            at com.tangosol.net.DefaultConfigurableCacheFactory.loadConfig(DefaultConfigurableCacheFactory.java:309)
            at com.tangosol.net.DefaultConfigurableCacheFactory.<init>(DefaultConfigurableCacheFactory.java:137)
            ... 15 moreThanks,
    Patrick

  • TopLink JPA  coherence

    we are using Toplink, JPA and coherence.
    can anyone point me to java code that depicts "How to warm up the coherence cache and then run queries against the cache. and then what happens if the at some point object is not in cache " ?
    thx
    D

    Warming the cache for a TopLink Grid enabled entity can be done by issuing a query for the objects you want to load into the cache along with the hint:
    query.setHint(QueryHints.QUERY_REDIRECTOR, new IgnoreDefaultRedirector());
    Which is discussed here: http://download.oracle.com/docs/cd/E14571_01/doc.1111/e16596/tlcgd003.htm#CHDGFCAI.
    You can also use JOIN and BATCH hints on the query if you want to load a graph of objects into the grid.
    With Grid Read and Grid Entity configurations all queries will be executed on the grid. Primary key queries on the grid for objects not present in the grid will result in a primary key select on the database if you've configured a CacheStore for a given entity's cache.
    Non-PK queries will only return what is in the grid. With Grid Read and Grid Entity is it your responsibility to ensure the grid is warmed up.
    --Shaun                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Toplink JPA forces database table and column names to UPPERCASE! Why?

    I have recently experienced using Toplink JPA while using glassfish ... migrating an existing application to EJB 3.0 persistence. Toplink JPA, as implemented in glassfish, forces tablenames and column names from my code to be uppercase in select statements, etc. as then submitted to the database. Why? I cannot find anything in the EJB 3.0 specs on persistence that even suggests this.
    This created a serious problem for me, in my application. For my code to work I had to change the names of the database tables to all uppercase, even though that meant other of my applications, already written using the original mixed case names of the databases, will no longer work unless I revise the code in those applications! (I am using mySQL as my database.)
    In both Unix/Linux and Java, which are both case sensitive, If I wanted names of files or other items to be uppercase, I would have written them that way. I do not expect some middleware piece of software to muck around with the case of text I have put into my code.
    I am hopeful this 'feature' of the reference implementation of the EJB Persistence API will be corrected in a subsequent version. [Maybe you can tell I am not happy!]
    Thanks for listening to my rant.

    Robert,
    I found that the name I specify in all of my @Table, @Column, ... annotations is used with the case as it is provided.
    If TopLink determines the schema information through defaults then the names it comes up with are definitely upper cased by default.
    Are you specifying the schema information that you want in annotations or XML?
    Doug

  • Jdeveloper 11 and/or toplink-jpa problem

    Hello,
    We have a big problem with toplink-jpa or jdev 11. I tried something very similar to the jdev/jpa tutorial (http://download-uk.oracle.com/otn_hosted_doc/jdeveloper/11/demos/JPA/JPA_Demo.html), only adapted to our db. I've been trying to solve this for hours, but whenever we run the sample facade client we created, we get this as only output:
    Error opening zip file: toplink/jlib/essentials-agent.jar
    Error occurred during initialization of VM
    agent library failed to init: instrument
    Process exited with exit code 1.
    I would greatly appreciate some support, I'm desesperate, this project being an experiment to see how we can evolve from "classic" toplink to toplink/jpa.

    Please also note: I tried this with jre 1.5.0.6 and 1.6.0.1 . The first one says "Error opening zip file: toplink/jlib/essentials-agent.jar", 1.6 says "Error opening zip file or JAR manifest missing : toplink/jlib/essentials-agent.jar".
    I also tried the 1.5.0.6 jvm which comes with jdev 10.x, which doesn't say (or does) anything.
    I downloaded the las version of toplink/jpa, without any change.
    All help greatly appreciated :-/

  • Useing toplink jpa in jdev11 and mysql4,but meet the DatabaseException

    Hello everyone,I'm useing toplink jpa in jdev11 and mysql4.I create a class from database success.Then I use "Java Service Facade" to create a class called JavaServiceFacade sucess.Then I add some code:
    System.out.println(javaServiceFacade.queryCnationalityFindAll().size())
    in main
    then I run the program,but I got this error:
    xception in thread "main" Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007))): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序
    Error Code: 0
         at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:290)
         at oracle.toplink.essentials.sessions.DefaultConnector.connect(DefaultConnector.java:87)
         at oracle.toplink.essentials.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:170)
         at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:218)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.connect(DatabaseAccessor.java:227)
         at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:294)
         at oracle.toplink.essentials.threetier.ConnectionPool.buildConnection(ConnectionPool.java:102)
         at oracle.toplink.essentials.threetier.ConnectionPool.startUp(ConnectionPool.java:324)
         at oracle.toplink.essentials.threetier.ServerSession.connect(ServerSession.java:443)
         at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:571)
         at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:208)
         at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:212)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:78)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:111)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:105)
         at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:76)
         at project6.JavaServiceFacade.getEntityManager(JavaServiceFacade.java:23)
         at project6.JavaServiceFacade.queryCnationalityFindAll(JavaServiceFacade.java:72)
         at project6.JavaServiceFacade.main(JavaServiceFacade.java:18)
    Caused by: java.sql.SQLException: [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序
         at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
         at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
         at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3074)
         at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323)
         at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
         at java.sql.DriverManager.getConnection(DriverManager.java:525)
         at java.sql.DriverManager.getConnection(DriverManager.java:140)
         at oracle.toplink.essentials.sessions.DefaultConnector.connect(DefaultConnector.java:85)
         ... 17 more
    there's some chinese you may not know,that means there's something wrong with
    Microsoft odbc.I'm puzzle of that:I'm useing java+mysql,why there's wrong with odbc???
    thank you very much
    (maybe it's jdev11 technical preview edition so it can't work?)

    HI
    can you reply the feedback of metalink? because I'm having similar problem.
    I debug in junit and embebbed at the jdev and it works well, but when I deploy in a standalone oc4j it gives me the same error of Excepção de E/S: The Network Adapter could not establish the connection
    And I'm not using 11g, I'm still in 10g but the problem might be the same.
    cumps
    DnlCY
    null

  • What are the relation between JPA and Hibernate, JPA and TopLink?

    What are the relation between JPA and Hibernate, JPA and TopLink?
    Can JPA instead of Hibernate and TopLink?

    The Java Persistence API (JPA) is the object relational mapping persistence
    standard for Java. Hibernate and TopLink provide an Open source Object-relational mapping framework for Java.
    They provide an implementation for the Java Persistence API. In my opinion, both Hibernate and TopLink provide support to JPA
    and they can also be regarded as the complementary to JPA.
    Let's wait to see other person's opinions.

  • Toplink JPA + Postgis

    Hello,
    Does TopLink JPA supports PostgreSQL together with Postgis extensions? As far as I know, for Hibernate, there is the Hibernate spatial plugin that handles geometric features. Does TopLink provide support for Postgis by default? In Google, there is not much information related to using Postgis together with Toplink.
    br, Christoph

    Christoph,
    there is support for PostgreSQL but no explicit support for Postgis . The mapping and querying frameworks are extensible to allow you to map custom types and SQL operators. Based on customer demand we added support for Oracle DB's spatial capabilities. A similar extension could be added for Postgis. I would recommend opening an enhancement request against EclipseLink (we now develop TopLink in this open source project).
    Doug

  • Automatic connection "ping" / health check in TopLink JPA ?

    Some days ago we experienced problems with our underlying Oracle database, so the DB server hat to be shut down and rebootet. The application server machine (running Apache Tomcat 5.5 on a Linux OS) which provides several web-applications that are using Toplink JPA were not restarted after the DB was up again.
    We encountered several subsequent "connection reset" errors within the webapps which where produced by TopLink JPA. I'd assume that this comes from the underlying restart of the DB, which invalidated/closed TopLink's JPA connection.
    is there any option e.g. to be set in persistence.xml to enable a Connection-"ping" or "health check" before TopLink JPA is using the connection?
    e.g.
    toplink.jpa.connection.ping = "select 1 from dual";
    regards,
    Hans

    Hans,
    There is nothing built in but you can use an ExceptionHandler to handle failures and re-connect connection. This is typically only an issue when using TopLink's internal connection pooling. It is more common in a container to use its data sources and rely on them to handle connection management.
    Doug

  • Couldn't persist OneToMany JoinColumn/JoinTable (Unidir) using TopLink JPA

    Hi All,
    I am having a lot of difficulty deploying a OneToMany Unidirectional (Zipcode) record which consist of multiple Zipnames using TopLink on Glassfish v2r2, JDK1.6.0_06, MySQL 5.0, Netbeans 6.1 and Windows XP platform.
    Below are the relevant EJBs snippets:
    Zipcode class
    @Entity
    @Table(name="ZIPCODE")
    public class Zipcode implements Serializable {
    @OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.EAGER)
    @JoinColumn(name="ZIPCODE_ID")    
                 or
        @JoinTable(name="ZIPCODE_ZIPNAME",          
                   joinColumns={@JoinColumn(name="ZIPCODE_ID")},
                   inverseJoinColumns={@JoinColumn(name="ZIPNAME_ID")})
        private Collection<Zipname> zipnames = new ArrayList<Zipname>();
        public Collection<Zipname> getNames()
         return zipnames;
        public void setZipnames(Collection<Zipname> zipnames)
         this.zipnames = zipnames;
    Zipname class does not maintain relationship back to Zipcode.
    public class ZipcodeApplicationClient {
    @PersistenceContext(unitName="GeographicalDB-PU")
    private static EntityManager manager;
        public ZipcodeApplicationClient() {
        public static void main(String[] args) {
            try {
                Zipcode zipcode_1 = new Zipcode();
                zipcode_1.setcode(9001);
                Zipname zipname_1 = new Zipname();
                zipname_1.setName("Harbour Cove");
                zipcode_1.getNames().add(zipname_1);
                // Can add one Zipname record with JoinTable but not JoinColumn
                Zipname zipname_2 = new Zipname();
                zipname_2.setName("Wonderland");
                zipcode_1.getNames().add(zipname_2);
                manager.persist(zipcode_1);   // line 45
    The same deployment error message below was generated from both JoinColumn and JoinTable methods:
    run-deploy:
    run-display-browser:
    run-ac:
    Copying 1 file to C:\Documents and Settings\Jack\GeographicalBean\dist
    Caught an unexpected exception!
    java.lang.NullPointerException
            at client.ZipcodeApplicationClient.main(ZipcodeApplicationClient.java:45)
            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:597)
            at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:266)
            at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:449)
            at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:259)
            at com.sun.enterprise.appclient.Main.main(Main.java:200)
    run-InvestmentBean-app-client:The JoinColumn method would not work for one Zipname record. On the other hand, JoinTable approach would allow us to add a single Zipname record without error out.
    Q1. Can you confirm whether TopLink JPA 1.0 (Glassfish v2r2) support OneToMany JoinColumn Unidirectional at all?
    Q2. Does TopLink JPA 1.0 (Glassfish v2r2) support OneToMany JoinTable Unidirectional? If so, what is the cause of this issue? Otherwise, please make appropriate recommendation steps to take.
    This question has been posted on http://forums.sun.com/thread.jspa?threadID=5330670&tstart=0 and http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=78&t=004489&p=1 earlier in the hope a quicker response.
    Your guidance would be very much appreciated.
    Many thanks,
    Jack

    Hi,
    Below are some more error output from the OneToMany JoinTable Unidirectional approach:
    pre-run-deploy:
    Initial deploying InvestmentBean to C:\Documents and Settings\abc\InvestmentBean\dist\gfdeploy
    Completed initial distribution of InvestmentBean
    Start registering the project's server resources
    Finished registering server resources
    moduleID=InvestmentBean
    deployment started : 0%
    deployment finished : 100%
    Deploying application in domain completed successfully
    Trying to create reference for application in target server completed successfully
    Trying to start application in target server completed successfully
    WARNING:
    JDO76614: Deployment encountered SQL Exceptions:
    JDO76609: Got SQLException executing statement "CREATE TABLE ZIPCODE (ID INTEGER NOT NULL, DIALING_CODE VARCHAR(255), TIME_ZONE VARCHAR(255), CODE INTEGER, NEAREST_AIRPORT VARCHAR(255), LONGITUDE VARCHAR(255), NEAREST_TRAIN_STATION VARCHAR(255), NEAREST_URBAN_CENTRE VARCHAR(255), HOTELS VARCHAR(255), LATITUDE VARCHAR(255), NEARBY_FEATURES VARCHAR(255), COUNCIL VARCHAR(255), LOCALITY VARCHAR(255), PRIMARY KEY (ID))": com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'zipcode' already exists
    JDO76609: Got SQLException executing statement "CREATE TABLE ZIPCODE_ZIPNAME (ZIPCODE_ID INTEGER NOT NULL, ZIPNAME_ID INTEGER NOT NULL, PRIMARY KEY (ZIPCODE_ID, ZIPNAME_ID))": com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'zipcode_zipname' already exists
    JDO76609: Got SQLException executing statement "CREATE TABLE ZIPNAME (ID INTEGER NOT NULL, NAME VARCHAR(255), PRIMARY KEY (ID))": com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'zipname' already exists
    JDO76609: Got SQLException executing statement "ALTER TABLE ZIPCODE_ZIPNAME ADD CONSTRAINT FK_ZIPCODE_ZIPNAME_ZIPCODE_ID FOREIGN KEY (ZIPCODE_ID) REFERENCES ZIPCODE (ID)": java.sql.SQLException: Can't create table '.\geographicaldb\#sql-434_4.frm' (errno: 121)
    JDO76609: Got SQLException executing statement "ALTER TABLE ZIPCODE_ZIPNAME ADD CONSTRAINT FK_ZIPCODE_ZIPNAME_ZIPNAME_ID FOREIGN KEY (ZIPNAME_ID) REFERENCES ZIPNAME (ID)": java.sql.SQLException: Can't create table '.\geographicaldb\#sql-434_4.frm' (errno: 121)Enable of InvestmentBean in target server completed successfully
    Enable of application in all targets completed successfully
    All operations completed successfully
    post-run-deploy:
    run-deploy:
    run-display-browser:
    run-ac:
    Copying 1 file to C:\Documents and Settings\Jack\GeographicalBean\dist
    Caught an unexpected exception!
    java.lang.NullPointerException
    at client.ZipcodeApplicationClient.main(ZipcodeApplicationClient.java:45)
    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:597)
    at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:266)
    at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:449)
    at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:259)
    at com.sun.enterprise.appclient.Main.main(Main.java:200)
    run-GeographicalBean-app-client:
    run:
    I would like to correct an earleir comment where I stated that this method did work when adding a single Zipname record. This is no true.
    Thanks,
    Jack

  • How to handle user exit sequence

    how do handle the userexit sequence i,e in which order the user exits are stored?

    one  and state solution
    go to debugger mode make  breakponint on statement call fm.
    and press f8 continiously and check exit fm one by one.

  • Stored procedure, EJB, JPA, and JavaServer Faces

    Hi!
    I am currently working on a Web application using EJB, JPA, and JavaServer Faces. A part of the
    business logic is already stored in the database as stored procedures, so we need to call those
    procedures (instead of named queries) through a EJB and represent the data on the web tier.
    Where can I find an extensive tutorial using this technology? There is no such tutorial in the Oracle Learning Library.
    Maybe somebody can provide a link and/or example.
    Thanks in advance for your help!

    Hi,
    http://download.oracle.com/docs/cd/B10464_05/web.904/b10313/queries.htm#1135305
    For more help, see the TopLink / JPA forum
    TopLink/JPA
    Frank

  • JPA and SQL Server 2005's  Identity Don't Play Nice

    I am hoping someone with a little more senior knowledge of JPASQL Server 2005 can point me in the right direction involving SQL Server 2005.
    What I am discovering is JPA and SQL Server 2005 do not playing nice together when you use the IDENTITY capability for
    a primary key. Let me explain. "...when using the IDENTITY as the generator type, the value for the identity field MAY NOT be
    available BEFORE the entity data is saved in the database because typically it is generated when a record is committed."
    My problem is this.
    I have two separate entities using another entity, for example a car has a wheel and a truck has a wheel. I can go through the steps
    of persisting the car and the wheel with no problem. My problem begins when I try to
    find the wheel (by wheel description) for the truck. The query finds the wheel, but does not return the primary key for wheel.
    Therefore, using the PK inside a query generates this error:
    java.lang.IllegalArgumentException: An instance of a null PK has been incorrectly provided for this find operation. What has been my appraoch to get the entity to commit to the database is to use the following sequence for the Entity Manager.
    entityManager.persist(wheel);
    entityManager.flush(); I have assumed to this point this action would persist my data because I have been able to retrieve the PK immidately after these steps.
    However, multiple actions taking place within the same transaction, appears to render the persist and flush steps useless. My initial thought
    is to wrap the wheel creation within a new transaction so when the method/transaction completes, the data would be in the database. This
    has not worked.
    I hope I have explained this clear for others to follow. I apologize in advance if I have not. Any suggestions are greatly appreciated.

    I am hoping someone with a little more senior knowledge of JPASQL Server 2005 can point me in the right direction involving SQL Server 2005.
    What I am discovering is JPA and SQL Server 2005 do not playing nice together when you use the IDENTITY capability for
    a primary key. Let me explain. "...when using the IDENTITY as the generator type, the value for the identity field MAY NOT be
    available BEFORE the entity data is saved in the database because typically it is generated when a record is committed."
    My problem is this.
    I have two separate entities using another entity, for example a car has a wheel and a truck has a wheel. I can go through the steps
    of persisting the car and the wheel with no problem. My problem begins when I try to
    find the wheel (by wheel description) for the truck. The query finds the wheel, but does not return the primary key for wheel.
    Therefore, using the PK inside a query generates this error:
    java.lang.IllegalArgumentException: An instance of a null PK has been incorrectly provided for this find operation. What has been my appraoch to get the entity to commit to the database is to use the following sequence for the Entity Manager.
    entityManager.persist(wheel);
    entityManager.flush(); I have assumed to this point this action would persist my data because I have been able to retrieve the PK immidately after these steps.
    However, multiple actions taking place within the same transaction, appears to render the persist and flush steps useless. My initial thought
    is to wrap the wheel creation within a new transaction so when the method/transaction completes, the data would be in the database. This
    has not worked.
    I hope I have explained this clear for others to follow. I apologize in advance if I have not. Any suggestions are greatly appreciated.

Maybe you are looking for

  • Older version of Pages?

    I can't download the new Pages since my computer doesn't have OS X 10.9. How can I get around the problem? Or is there anything to do about the problem that my Open Office has flipped and says that there are pages that needs to be re-opened, but I ca

  • Database Keeps On Switching During Migration

    Hello. I am currently doing a mailbox migration from Exchange 2007 to Exchange 2013. I have 4 databases in Exchange 2013 which are A, B, C and D (each with different quotas). The databases have their copies on another Exchange server under DAG. Durin

  • Call dll from javascript

    hai, i have a dll(VB) in client m/c. i need to call a method in a dll from javascript. if possible please give some sample code.

  • One time charge for an Item in sales order

    Hi: The situation we have is that when a order comes in for a part, we need to have a one time charge (installation charge per say). Any subsequent orders for the same part by that customer should not include that charge. I can certainly code in user

  • PSAPUNDO tablespace shows 100% full over a long time in oracle 11.2

    Dear Experts, In our server PSAPUNDO table space showing 100% full since three weeks and due to this space critical objects found in PSAPUNDO tablespace. PSAPUNDO has automatic management enable. Referred Note 1035137  but no clue found. Kindly sugge