Toplink Essentials how to use scope_identity w/ sqlserver

I created a class that extends SQLServerPlatform and overrode the method buildSelectForNativeSequence with:
public ValueReadQuery buildSelectQueryForNativeSequence() {
return new ValueReadQuery("select scope_identity() AS 'identity' ");
When I run a test I get and error.
I can see from the log that toplink is now using scope_identity instead of @@Identity. What is the problem?
I cannot use @@Identity because triggers are firing on the insert table which is causing the wrong identity to be returned.
Please help!!!!
[TopLink Fine]: 2007.04.02 12:06:33.281--ClientSession(14384648)--Connection(3803825)--Thread(Thread[AWT-EventQueue-0,6,main])--INSERT INTO Personnel (AssignedBy, AssignmentType, CaseId, LastEditedBy, DateAssigned, _version, LastEditedOn, TimeAssigned, cruiser, OfficerId) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
bind => [0000, 1, 8, greg, 2007-04-05 12:06:18.859, 1, 2007-04-02 12:06:33.109, 12:06, null, 0087]
[TopLink Finest]: 2007.04.02 12:06:33.281--ClientSession(14384648)--Thread(Thread[AWT-EventQueue-0,6,main])--Execute query ValueReadQuery()
[TopLink Fine]: 2007.04.02 12:06:33.281--ClientSession(14384648)--Connection(3803825)--Thread(Thread[AWT-EventQueue-0,6,main])--select scope_identity() AS 'identity'
[TopLink Warning]: 2007.04.02 12:06:33.296--UnitOfWork(22481956)--Thread(Thread[AWT-EventQueue-0,6,main])--Local Exception Stack:
Exception [TOPLINK-4011] (Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Exception Description: Error preallocating sequence numbers. The sequence table information is not complete.
at oracle.toplink.essentials.exceptions.DatabaseException.errorPreallocatingSequenceNumbers(DatabaseException.java:137)

The error seems to indicate that null is being returned. Verify that scope_identity is returning the correct value. Switching to using a sequence table would workaround the issue and improve your performance through allowing sequence pre-allocation.

Similar Messages

  • JPA / Toplink Essentials / How to set Table Qualifier?

    Hello!
    How can i set a table qualifier for toplink essentials (JPA)?
    Using toplink I can use setTableQualifier("...");
    regards
    Harald.

    If I add orm.xml along to persistence.xml in the META-INF directly, TopLink JPA obviously finds it regarding to its log output:
    Searching for default mapping file in file:/C:/<path_to_webapp>/WEB-INF/classes/
    Found a default mapping file at file:/C:/<path_to_webapp>/WEB-INF/classes/META-INF/orm.xml for root URL file:/C:/<path_to_webapp>/WEB-INF/classes/
    But it seems as the "schema" property I set under persistence-unit-defaults is ignored. The orm.xml file looks like this:
    <persistence-unit-metadata>
         <persistence-unit-defaults>
              <schema>schema_name</schema>     
         </persistence-unit-defaults>
    </persistence-unit-metadata>
    The queries logged by TopLink JPA to not add qualifiy table names with the schema_name configured above!!!
    Any idea?
    Hans

  • Toplink Essentials: how can I not to auto persist computed/virtual column

    Tags: Toplink Essentials, JPA, virtual columns
    Hi All,
    This appears to be a newbie question. But I cannot get it solved.
    First, my system is Eclipse + TOPlink essentials.
    My relational db table has a computed column. It is derived from a column of the same table.
    create table WINE(
    WINE_NAME VARCHAR2(25),
    WINE_STORAGE_DATE DATE,
    VINTAGE AS (EXTRACT(YEAR FROM WINE_STORAGE_DATE))
    In my JAVA entity, I would like to map VINTAGE into a "auto-generated" field. In this way, when I update relational db table, VINTAGE won't be in the JPA generated INSERT statement, but I can query the VINTAGE into my java entity/object.
    I tried the following JPA annotation in my java entity class.
    @Entity
    public class Wine implements Serializable {
    @GeneratedValue private Integer VINTAGE;
    I can query db table -- VINTAGE flows from db table to my java object. But when I update table ( I left VINTAGE un-specified ), I get the following error:
    Internal Exception: java.sql.SQLException: ORA-54013: INSERT operation disallowed on virtual columns
    Error Code: 54013
    Call: INSERT INTO WINE(WINE_NAME, WINE_STORAGE_DATE, VINTAGE) VALUES (?, ?, ?)
         bind => PinotNoir, 2003-01-05 00:00:00.0, null
    Any suggestions on what annotation tage I should use to tell the JPA Provider not to include VINTAGE in the auto-generated INSERT statement?
    Thank you very much.
    Jing
    Edited by: user11935396 on Sep 25, 2009 1:36 PM
    Edited by: user11935396 on Sep 25, 2009 1:37 PM

    I am not sure if your annotation @GeneratedValue is proper. According to javadoc "Provides for the specification of generation strategies for the values of primary keys. The GeneratedValue annotation may be applied to a primary key property or field of an entity or mapped superclass in conjunction with the Id annotation."
    I would rather try to annotate VINTAGE as @Column(insertable=false, updatable=false)

  • How to use (toplink essentials)JPA with EJB 2.1 spec in oc4j 10.1.3.2

    I have an application that uses EJB 2.1 spec with SLSB (no entity beans) and uses DAO pattern with hibernate2 for persistence. I want to replace hibernate with toplink-essentials (JPA). I cannot upgrade the EJB spec version as we use some thirdparty beans. The application uses DAO pattern so I should be able to hook in a new toplink DAO impl. What I am struggling with is how do I get hold of the EntityManagerFactory in my EJB 2.1 SLSB. Also I need CMT with XA transactions as our application interacts with jms and database using MDBs and SLSBs.
    Prantor

    You should be able to use Persistence.createEntityManagerFactory(<your-persistence-unit-name>, properties), and create your EntityManager from that.
    To have TopLink integrated with JTA, in your persistence.xml (or properties) you need to use a JTA DataSource, and set the ServerPlatform for your JEE server.

  • How to verify OC4J uses Oracle Toplink 10.x and not Toplink Essentials

    Hi,
    We dont want to use the default JPA provider "Toplink *Essentials*" that comes with OC4J. Rather we want to use Oracle Toplink 10.x
    I downloaded [Oracle Toplink 10.x|http://www.oracle.com/technology/software/products/ias/htdocs/1013topsoft.html] and followed the installation instructions:- http://www.oracle.com/technology/products/ias/toplink/doc/10131/install/install.html#CHDBBIFB
    When i deploy my EJB 3.0 appliation and invoke a JPA Entity, i can see the server log:- NOTIFICATION TopLink, version: Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))
    Do i have to do any other configuration/setting to ensure that i use Oracle Toplink and not Toplink Essentials in OC4J?
    Thanks in Advance,
    Prashant Tejura
    Edited by: user1186295 on May 26, 2009 10:33 AM

    rashant,
    Hi, there are currently the following providers to choose from - you may want to consult your rep for any details on moving from 10.1.3.4 to 10.1.3.5.
    1) TopLink or EclipseLink using EclipseLink JPA - the RI for JPA for WebLogic, OC4J and GlassFish
    - EclipseLink JPA is focus of all current JPA development as part of EclipseLink and TopLink
    2) Another open-source JPA implementation like OpenJPA or Hibernate
    Deprecated:
    3) TopLink using TopLink JPA - replaced by (1) TopLink using EclipseLink JPA
    4) TopLink using TopLink Essentials JPA - replaced by (1) TopLink using EclipseLink JPA
    Changes to server.xml as follows:
    http://wiki.eclipse.org/EclipseLink/Examples/JPA/OC4J_Web_Tutorial#Modify_server.xml
    <shared-library name="oracle.persistence" version="1.0" library-compatible="true">
              <code-source path="../../../eclipselink/eclipselink.jar"/>
              <code-source path="../../../eclipselink/javax.persistence_*.jar"/>
              <import-shared-library name="oracle.jdbc"/>
         </shared-library>
    Changes to persistence.xml as follows: (container-managed JTA datasource)
    http://wiki.eclipse.org/EclipseLink/Examples/JPA/OC4J_Web_Tutorial#Persistence.xml
    <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    <persistence-unit name="example" transaction-type="JTA">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>jdbc/OracleDS</jta-data-source>
    <class>org.eclipse.persistence.example.jpa.server.business.Cell</class>
    <properties>
    <property name="eclipselink.target-server" value="OC4J"/>
    <property name="eclipselink.logging.level" value="FINEST"/>
    </properties>
    </persistence-unit>
    </persistence>
    You should see output similar to the following in your server log:
    http://wiki.eclipse.org/EclipseLink/Examples/JPA/OC4J_Web_Tutorial#Console_Output
    [EL Finest]: 2009-02-26 14:04:34.464--ServerSession(8634980)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--Begin deploying Persistence Unit example; state Predeployed; factoryCount 1
    [EL Info]: 2009-02-26 14:04:34.542--ServerSession(8634980)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--EclipseLink, version: Eclipse Persistence Services - ***
    [EL Fine]: 2009-02-26 14:04:35.213--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--Detected Vendor platform: org.eclipse.persistence.platform.database.oracle.Oracle10Platform
    [EL Config]: 2009-02-26 14:04:35.26--ServerSession(8634980)--Connection(5230779)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--Connected: jdbc:oracle:thin:@//1y.yyy.yy.yy:1521/ORCL
         User: SCOTT
         Database: Oracle Version: Oracle Database 11g Release 11.1.0.0.0 - Production
         Driver: Oracle JDBC driver Version: 10.1.0.5.0
    [EL Finest]: 2009-02-26 14:04:35.385--UnitOfWork(5746770)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--PERSIST operation called on: org.eclipse.persistence.example.jpa.server.business.Cell@9107088( id: null state: null left: null right: null parent: null references: null).
    [EL Fine]: 2009-02-26 14:04:35.807--ClientSession(5748500)--Connection(6653899)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--INSERT INTO EL_CELL (ID, STATE, TSEQ, RIGHT_ID) VALUES (?, ?, ?, ?)
         bind => [551, null, null, null]
    thank you
    /michael
    www.eclipselink.org

  • TopLink Essentials: Using spring session scope on the EntityManagerFactory

    Hi,
    In one of our projects we are trying to utilize the 2nd level cache of TopLink Essentials. The server code is using the Spring (2.0.7) and is deployed to a web container. We are using a Java client and serializes every object between the client and the server.
    When a client is started a lot of "static/common" data is read from the server. The first client started will therefor pay some extra performance cost, but additional clients should hopefully be able to perform better due to the cache. Most of the static data is accessed not using JPQL and should therefor not bypass the cache.
    If we configure the EntityManagerFactory using default Spring scoping (singleton) it seems like we are not able to utilize the cache. We can see from the log files that each time a client is started a lot of SQL is executed towards the database (Oracle).
      <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="jpaVendorAdapter">
          <bean class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter">
            <property name="showSql" value="false" />
            <property name="generateDdl" value="$repository{toplink.generateDdl}" />
            <property name="database" value="$repository{toplink.database}" />
          </bean>
        </property>
        <property name="jpaProperties">
          <props>
            <prop key="toplink.weaving">static</prop>
            <prop key="toplink.logging.level">FINEST</prop>
          </props>
        </property>
      </bean>When we changes the scoping to spring session the behavior is very different. Then we can see that the first client generates a lot of SQL towards the database and pays a startup cost, while subsequently clients seems to be able to utilize the cache.
      <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" scope="session">
        <aop:scoped-proxy />
        <property name="dataSource" ref="dataSource" />
        <property name="jpaVendorAdapter">
          <bean class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter">
            <property name="showSql" value="false" />
            <property name="generateDdl" value="$repository{toplink.generateDdl}" />
            <property name="database" value="$repository{toplink.database}" />
          </bean>
        </property>
        <property name="jpaProperties">
          <props>
            <prop key="toplink.weaving">static</prop>
            <prop key="toplink.logging.level">FINEST</prop>
          </props>
        </property>
      </bean>Having read the documentation of the spring session scope I'm having a hard time explaining this behavior. As I understand it the EntityManagerFactory will be stored in the HTTP session resulting in a new EntityManagerFactory for each session. I cannot understand how this may result in that we are able to utilize the 2nd level cache? What are the relationship between the EntityManagerFactory and the 2nd level cache?
    Is this an accepted way of configuring the EntityManagerFactory or will there be a downside?
    I hope someone are able to explain this behavior for me:-)
    Best regards,
    Rune

    Hi Rune,
    To understand the shared cache behavior you actually need to understand more about what TopLink Essentials does than what Spring does. When a new factory is created, TopLink Essentials actually just proxies the server session with a factory instance, so the same server session is used. This is why you are seeing the same cache used across multiple factories of the same session.
    In the first case, if you are not using JPQL then what are you using to load the data and why are you thinking that it will not bypass the cache?
    Using a factory instance for each session is not what I would recommend doing as there are some additional costs associated with establishing a factory (even though the session already exists). The first way should be the correct way, I am just not sure what the circumstances are that are causing your cache to not be warmed. You may want to post more details about that so people can better help you out with that angle.
    -Mike

  • Toplink Essentials JPA doesn't use GenerationType.IDENTITY

    Based on EJB 3 and JPA I want to store some entities (@Entity) in a database. For some of those entites the database auto increments the primary key. In these cases I defined a @TableGenerator and a @GeneratedValue using GenerationType.IDENTITY as strategy in order to get the primary key (@Id) updated after the entity has been persisted.
    Short example:
    @Entity
    @Table(name = "orders")
    public class POrder implements PEntity {
         @TableGenerator(name = "orderIdGenerator", initialValue = 0, allocationSize = 1)
         @Id
         @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "orderIdGenerator")
         @Column(name = "orderNumber", nullable = false)
         private Integer orderNumber;
    ...I am running the application on GlassFish. I added a corresponding JDBC resource to the server configuration, using the specific MySql driver interfaces.
    Persisting entities which doesn't use a TableGenerator works, but as soon as I try to persist an entity which should use a TableGenerator I am running in the following exception:
    beergame.server.exception.BeergameServerException: nested exception is: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.1 (Build b55-fcs (10/10/2008))): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'beergame3.sequence' doesn't exist
    Error Code: 1146
    Call: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?
         bind => [1, roleIdGenerator]
    Query: DataModifyQuery()
    Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.1 (Build b55-fcs (10/10/2008))): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'beergame3.sequence' doesn't exist
    Error Code: 1146
    Call: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?
         bind => [1, roleIdGenerator]
    Query: DataModifyQuery()
         at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:311)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:654)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:703)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:492)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:452)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.executeCall(AbstractSession.java:690)
         at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228)
         at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:214)
         at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeNoSelectCall(DatasourceCallQueryMechanism.java:257)
         at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeNoSelect(DatasourceCallQueryMechanism.java:237)
         at oracle.toplink.essentials.queryframework.DataModifyQuery.executeDatabaseQuery(DataModifyQuery.java:86)
         at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:628)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:1845)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:952)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:924)
         at oracle.toplink.essentials.sequencing.QuerySequence.update(QuerySequence.java:344)
         at oracle.toplink.essentials.sequencing.QuerySequence.updateAndSelectSequence(QuerySequence.java:283)
         at oracle.toplink.essentials.sequencing.StandardSequence.getGeneratedVector(StandardSequence.java:96)
         at oracle.toplink.essentials.sequencing.Sequence.getGeneratedVector(Sequence.java:281)
         at oracle.toplink.essentials.internal.sequencing.SequencingManager$Preallocation_Transaction_NoAccessor_State.getNextValue(SequencingManager.java:420)
         at oracle.toplink.essentials.internal.sequencing.SequencingManager.getNextValue(SequencingManager.java:846)
         at oracle.toplink.essentials.internal.sequencing.ClientSessionSequencing.getNextValue(ClientSessionSequencing.java:110)
         at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.assignSequenceNumber(ObjectBuilder.java:240)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.assignSequenceNumber(UnitOfWorkImpl.java:355)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.registerNotRegisteredNewObjectForPersist(UnitOfWorkImpl.java:3266)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.registerNotRegisteredNewObjectForPersist(RepeatableWriteUnitOfWork.java:432)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:3226)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.persist(EntityManagerImpl.java:221)
         at com.sun.enterprise.util.EntityManagerWrapper.persist(EntityManagerWrapper.java:440)
         at beergame.server.model.trans.impl.TExtensionOfPEntityImpl.persist(TExtensionOfPEntityImpl.java:130)
         at beergame.server.model.trans.impl.TRoleImpl.<init>(TRoleImpl.java:61)
         at beergame.server.logic.trans.impl.GameLogicImpl.assignUserToValueChainLevel(GameLogicImpl.java:81)
         at beergame.server.logic.remote.impl.UserSessionBean.createGame(UserSessionBean.java:65)
    I wonder why a sequence table has to be update whereas IDENTITY is defined as strategy. I tried also AUTO as strategy but it doesn' matter, the result is the same.
    I read several posts in forums, but couldn't find a solution. So I still have no idea how to get IDENTITY used as strategy. Any one of you does?
    My configuration:
    IDE: Eclipse 3.4.0
    Server: GlassFish V2 Java EE 5
    JPA Implementation: Toplink Essentials v2.1-b55
    JPA driver: oracle.toplink.essentials.PersistenceProvider
    Database: MySQL 5.0.51a
    JDBC driver: mysql-connector-java-5.1.5

    I did it. I must admit, I was a little bit confused by the annotation TableGenerator. It is not responsible for generating ids of a table at all but only in conjunction with a table which should provide ids.
    After I removed @TableGenerator and also the corresponding reference within @GeneratedValue the persistence works as expected. Now the code looks like this:
    @Entity
    @Table(name = "orders")
    public class POrder implements PEntity {
         @Id
         @GeneratedValue(strategy = GenerationType.IDENTITY)
         @Column(name = "orderNumber", nullable = false)
         private Integer orderNumber;
    ...Edited by: TomCat78 on Oct 12, 2008 3:38 PM

  • How to call a stored procedure from EJB3/toplink essentials..?

    Hi,
    I want to call a stored procedure residing in the oracle 10 g Database from my application's data access layer, which is designed using EJB3/toplink essentials.
    I think this feature is not available right now in the EJB3 spec...any workaround with code if possible will be very help full...
    Thanks & Regards,
    Sarvesh

    This should help you....
    how to execute a stored procedure from ejb3.0 bean using entity manager

  • [JPA] Invalidate TopLink Essentials' L2 cache. How?

    Hi,
    I'm trying to invalidate the L2 cache of TopLink Essentials. In Java SE, I try something like this:
         Customer cust = em.find(Customer.class, 1L);
         System.out.println(cust);
         em.clear();
         em.close();
         em = emf.createEntityManager();
         Session session = ((EntityManagerImpl)em).getSession();
         session.getIdentityMapAccessor().invalidateAll();
         cust = em.find(Customer.class, 1L);
         System.out.println(cust);The trouble is that only ONE SQL statement is generated, not two, as I would have expected.
    In Oracle Application Server, I cannot even get this far because I cannot cast to EntityManagerImpl. There, the class hierarchy is:
         com.evermind.server.ejb.persistence.EntityManagerProxy
                implements com.evermind.server.ejb.persistence.ContainerEntityManager
         com.evermind.server.ejb.persistence.AbstractEntityManagerProxy
                implements javax.persistence.EntityManager
         java.lang.ObjectSo, how can I do this in Java SE and in a container?
    Best regards,
    Bisser

    Hello Bisser,
    getSession() only returns the active session (the underlying UnitOfWork) if one is available or null if not. Use getServerSession() instead.
    As for in the container, you need to call getDelegate() to get the wrapped entitymanager.
    Best Regards,
    Chris

  • Unable to deploy Web App using JPA TopLink Essentials in Tomcat5.5.17

    Hi All,
    I am trying to deploy a Web App ( used Top Link Essentials ) to Tomcat and i am getting the following Error..
    I am strating tomcat using -javaagent:/Path/To/spring-agaent.jar
    Dec 14, 2006 9:52:46 AM org.apache.catalina.loader.WebappClassLoader loadClass
    INFO: Illegal access: this web application instance has been stopped already.  Could not load oracle.toplink.essentials.internal.weaving.ClassDetails.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
    java.lang.IllegalStateException
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1238)
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
            at oracle.toplink.essentials.internal.weaving.TopLinkWeaver.transform(TopLinkWeaver.java:84)
            at org.springframework.orm.jpa.persistenceunit.ClassFileTransformerAdapter.transform(ClassFileTransformerAdapter.java:56)
            at sun.instrument.TransformerManager.transform(TransformerManager.java:122)
            at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:155)
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
            at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1812)
            at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:866)
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1319)
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
            at java.lang.Class.getDeclaredConstructors0(Native Method)
            at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
            at java.lang.Class.getConstructor0(Class.java:2671)
            at java.lang.Class.newInstance0(Class.java:321)
            at java.lang.Class.newInstance(Class.java:303)
            at org.apache.myfaces.application.ApplicationImpl.createComponent(ApplicationImpl.java:396)
            at com.sun.faces.config.ConfigureListener.verifyObjects(ConfigureListener.java:1438)
            at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:509)
            at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3729)
            at org.apache.catalina.core.StandardContext.start(StandardContext.java:4187)
            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
            at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
            at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:608)
            at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:535)
            at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
            at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
            at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
            at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
            at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
            at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
            at org.apache.catalina.core.StandardService.start(StandardService.java:450)
            at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
            at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
            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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
            at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432) Thanks
    Sateesh

    Spring 2.0 provides custom support for TopLink Essentials in Tomcat out-of-the-box. You should follow the instructions here: http://static.springframework.org/spring/docs/2.0.x/reference/orm.html#orm-jpa-setup-lcemfb-tomcat
    Essentially, Spring provides a custom class loader for Tomcat and doesn't use an agent.
    --Shaun                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to use bind_variable for connectivity between Oracle and SQLServer 2005

    The code specified below could be used as an example of how to call a remote SQLServer 2005 procedure from Oracle.
    The problem I am facing is that I am not able to use the dbms_hs_passthrough.bind_variable without exceptions.
    Could someone help me out on this?
    declare
    CREATE PROCEDURE dbo.OrcaMessageTranslator
    @inp nvarchar(255),
    @outp nvarchar(255) output
    AS
    BEGIN
    select @outp = @inp+'output'
    END
    c integer;
    nr integer;
    inp varchar2(255);
    outp varchar2(255);
    sql_stmt varchar2(32767);
    begin
    dbms_output.put_line('call SQLServer procedure OrcaMessageTranslator');
    dbms_output.put_line('value of input variable inp is HowToReplaceThisValueByBindVariable ');
    sql_stmt := 'DECLARE @outp nvarchar(255)
    EXEC dbo.OrcaMessageTranslator
    @inp = N''HowToReplaceThisValueByBindVariable'',
    @outp = @outp OUTPUT
    SELECT @outp as N''@outp''';
    c := dbms_hs_passthrough.open_cursor@pp_preorca;
    dbms_hs_passthrough.parse@pp_preorca(c,sql_stmt);
    nr := dbms_hs_passthrough.fetch_row@pp_preorca(c);
    dbms_hs_passthrough.get_value@pp_preorca(c, 1, outp);
    dbms_hs_passthrough.close_cursor@pp_preorca(c);
    dbms_output.put_line('acquired value of output variable outp is '||outp);
    end;

    Hi,
    BIND_VARIABLE is useful when you have only IN variable but in your case you have IN and OUT.
    I don't know if you use the gateway for MS SQL SERVER or HSODBC/DG4ODBC but here how you can do to call a remote procedure with bind variables:
    DECLARE
    ret integer;
    inp varchar2(255);
    outp varchar2(255);
    BEGIN
    inp :='Hello World';
    outp :='';
    ret := "dbo"."in_out_proc_test"@tg4msql( inp, outp);
    dbms_output.put_line('Input value: ' ||v_ut1||' - Output value: '||v_ut2);
    END;
    The MS SQL Server procedure belongs to the user "dbo" and the database link
    being used is tg4msql.
    The following line initilaize the out variables of the procedure with an
    empty string:
    outp :=''
    I hope it helps you.
    Regards
    Mireille

  • How to use TopLink's mapping info at runtime

    Can anybody kindly instruct how to do the following:
    1) Once the "JavaSource.java" file or the "ProjectDeployment.xml" file is generated by TopLink from a TopLink project, how can it be included and used in a J2EE project at runtime? I understand that this step may be specific to the type of IDE used, let us say WebLogic, WebSphere or JDeveloper9i.
    2) Can TopLink generate the file "sessions.xml" automatically or it has to be hard-coded? Does this file have also to be included in a J2EE project under the directory of META-INF at runtime?

    Hi John,
    Probably the best way I can explain the process of putting a J2EE app with TopLink into production would be to describe the best practices of doing so.
    Firstly, I recommend using an IDE to develop your Java source code, although it is possible to generate Java source directly from the Mapping Workbench, this is considered more of a rapid prototyping or quick start process. Once the Java source has been compiled, the Meta-Data (project.xml) can be deployed from the Mapping Workbench.
    The next step really depends on the type of application you are creating. Since you are developing a J2EE based application and it will be multi-user, TopLink recommends using a ServerSession architecture. (Consult the documentation for detailed explanations). Configuring the session can be done in a number of ways, the best way would be to use the SessionManager and an external file called sessions.xml. Both the sessions.xml and project.xml must be visible by the J2EE component that will be using it. (Servlet/Session Bean, etc...). This is done through managing your deployment properly using something like an EAR.
    The key to getting the application and TopLink working together is the session, and here's a basic example on how you could set this up:
    sessions.xml code:
    <toplink-configuration>
         <session>
              <name>myProject</name>
              <project-xml>myProject.xml</project-xml>
              <session-type>
                   <server-session/>
              </session-type>
              <connection-pool>
                   <is-read-connection-pool>false</is-read-connection-pool>
                   <name>default</name>
                   <max-connections>10</max-connections>
                   <min-connections>5</min-connections>
              </connection-pool>
              <enable-logging>true</enable-logging>
         </session>
    </toplink-configuration>
    Somewhere in your application code, you might have a login method that makes use of the SessionManager to load and create the session:
    SessionManager sm = SessionManager.getManager();
              Server serverSession = (Server)sm.getSession("myProject", this.getClass().getClassLoader());
    The sessions.xml must be created manually at this point, a future version of the TopLink product will contain an editor which will help out.
    Darren Melanson

  • How to use the Oracle AQ JMS API using Toplink

    My application is using AQ using PL/SQL. We want to convert the PL/SQL code to the JMS interface Oracle offers, the problem is that I need to use a java.sql.Connection object in order to connect to the AQ. I don't own the java.sql.Connection in Toplink. How can I enqueue/dequeue to a JMS AQ using Toplink?

    In the upcoming 10.1.3 release, TopLink supports mapping to/from Oracle AQ messages through a JCA adapter. This functionality is currently available in the 10.1.3 developer preview release on the Oracle OTN web site. If you have an earlier version of TopLink, using AQ directly may make more sense with TopLink only being used to access an existing JDBC connection.
    To use AQ directly a JDBC connection is required - then the AQ JMS interface can be used to access any messages. If TopLink has a JDBC connection with Oracle AQ, it (the JDBC connection) can be accessed via session.getAccessor().getConnection(). Also, if a J2EE datasource/connection pool is being used a JDBC connection could be obtained there as well. One thing to note is that creating a new JDBC connection would be 'safer', as this would avoid having the connection managed when it shouldn't be.
    For information on how Oracle TopLink provides EIS access to AQ, please refer to: http://www.oracle.com/technology/products/ias/toplink/preview/howto/eisAq/index.htm

  • How to use Toplink as SDO in Oracle BPEL

    can we use Toplink as SDO for BPEL?

    We have not yet shipped our TopLink SDO implementation. The intent is that in our next major release the TopLink SDO will be used internally and should be available for your usage in the OracleAS/SOA suite.
    Doug

  • Accessing the Session in Toplink Essentials

    I try access session by this way:
    http://ontoplink.blogspot.com/2007/01/accessing-session-in-toplink-essentials.html
    and get exception:
    (Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007))): oracle.toplink.essentials.exceptions.ValidationException
    Exception Description: Could not find the session with the name [my_name] in the session.xml file []
    Is session.xml needed for this ? I hope not, because it requires project.xml and it maybe require some another... All what I need is:
    session.getEventManager().addListener(myEventListener);
    to force toplink switch database schema in listener preLogin method. In Hibernate, it can be done by one line in config file.
    Lumir

    OK, I tried obtain session BEFORE creating EntityManagerFactory and EntityManager.
    Now when obtaining it AFTER creating EMF and EM, it works.
    But this not solve problem with change db schema, because AFTER create EMF and EM, session is logged in and EventListener preLogin isn't called.
    Can anyone point me, how to change db schema ? I know it for connection defined using toplink.jdbc.* properties, but not for JNDI:
    public class ToplinkSessionCustomizer implements SessionCustomizer
    public void customize(Session session) throws Exception
              if(jdbcUrl == null)
                   // JDBC URL is not set, assume JNDI lookup
                   JNDIConnector connector = (JNDIConnector) session.getLogin().getConnector();
                   connector.setLookupType(JNDIConnector.STRING_LOOKUP);
                   // 1. Not works, cause NPE
                   // at oracle.toplink.essentials.descriptors.ClassDescriptor.verifyTableQualifiers(ClassDescriptor.java:3518)
                   session.getDatasourcePlatform().setTableQualifier(schema);
                   SessionEventAdapter preLoginEventListener = new SessionEventAdapter()
                   // Listen for preLogin events
                        public void preLogin(SessionEvent event)
                        event.getSession().getLogin().setTableQualifier("myschema");
                   // 2. Not works, eventManager is null, cause NPE !
                   session.getEventManager().addListener(preLoginEventListener);
              else
    // This works OK
                   DatabaseLogin login = session.getLogin();
                   login.useOracleThinJDBCDriver();
                   login.setDatabaseURL(jdbcUrl);
                   login.setUserName(userName);
                   login.setPassword(password);
                   login.setTableQualifier(schema);
         }

Maybe you are looking for

  • Considerin​g datafinder for publishing data

    Hi I am considering a data publishing system.  We currently have a server that holds data in the form of CSV files. We require a system that allows multiple clients (offsite - around the world) to access/view/analyse the data, ie view logged data for

  • How do I get full display on sony tv w/macbook pro

    how do I get full display on sony tv w/macbook pro? I am using mini dv adapter to pc input cable.(I believe hd15) not HDMI adapter.

  • Need Help On Statement.......

    I'm currently stuck with this statement: Container container = getContentPane( ); What is a container ? And what is the function getContainPane? And what is a Pane? Please help me...................................

  • Returnable Transport Packaging Material In ASN ( EDI -856)

    Hi, We are working on inbound delivery creation with returnable transport packaging (RTP) materials. We want to create inbound delivery with RTP and we are passing RTP material in E1EDL24 without reference document (i.e. purchase order or PSA) as we

  • Saving an Editted Version to iPhoto

    Here's my workflow for working with photos: -Import photos into iPhoto -Edit them in PSCS3 -Save them It shows up fine in iPhoto. But let's say I want to take a photo and edit it and save a color version and a black and white version. Now when I "Sav