Using TopLink with ADF?

I've downloaded the JDeveloper 10g preview, and I'm interested in the provided ADF features. The online Help says "When you want to create ADF application clients that work with other business services, including... TopLink mappings... see the available documentation on the JDeveloper page of OTN", but I don't see this documentation? Is it available yet? If so, could someone please post a link?
Thanks!

Duh, sorry, that "more" link sure is helpful...
http://technet.oracle.com/products/jdev/collateral/tutorials/9050/toplinkdatabinding_tut.html

Similar Messages

  • Problem using Toplink with JUnit

    Hi,
    I have a problem using Toplink with JUnit. Method under test is very simple: it use a static EntityManager object to open a transaction and persists data to db. When I invoke the method from a test method, it gives me the exception:
    java.lang.AssertionError
         at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.computePURootURL(PersistenceUnitProcessor.java:248)
         at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.findPersistenceArchives(PersistenceUnitProcessor.java:232)
         at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.findPersistenceArchives(PersistenceUnitProcessor.java:216)
         at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initialize(JavaSECMPInitializer.java:239)
         at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initializeFromMain(JavaSECMPInitializer.java:278)
         at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.getJavaSECMPInitializer(JavaSECMPInitializer.java:81)
         at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:119)
         at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
         at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
         at it.valerio.electromanager.model.EntityFacade.<clinit>(EntityFacade.java:12)
         at it.valerio.electromanager.business.ClienteBiz.insertIntoDatabase(ClienteBiz.java:36)
         at it.valerio.electromanager.test.model.ClienteTest.insertDBTest(ClienteTest.java:30)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
         at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
         at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
         at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
         at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
         at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
         at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
         at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
         at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
         at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
         at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
         at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Where is the problem???
    Regards,
    Valerio

    EntityFacade class is very simple and it uses a static EntityManager object. Here the code:
    public class EntityFacade {
         private static EntityManager em = Persistence.createEntityManagerFactory("ElectroManager").createEntityManager();
         private static Logger logger=Logger.getLogger(EntityFacade.class);
         public static void insertCliente(Cliente c)
              logger.debug("Inserisco cliente nel db: " + c);
              em.getTransaction().begin();
              c.setId(getNextIdForTable("Cliente"));
              em.persist(c);
              em.getTransaction().commit();
    If I call the method from inside a main it works well, so I think the problem is not the classpath neither the URL in the persistence.xml. However the URL is:
    <property name="toplink.jdbc.url" value="jdbc:derby:c:/programmi/ElectroManager/db/electroManager"/>
    I use the latest build version of TopLink.
    Thanks.

  • Using Facelets with ADF

    Hi,
    I am trying to use Facelets with ADF but unable to get the desired output i.e. the Facelet regions are not working as desired.
    My Jdeveloper version is:
    10.1.3.0.4(SU4)
    Please help me out as early as possible.
    Thank You.

    https://facelets.dev.java.net/nonav/docs/dev/docbook.html#taglib-available-adf

  • Anyone using facelets with ADF Faces and myfaces implementation?

    There is a Howto document for using facelets with ADF Faces, but it assumes you're using Sun's RI. I'd like to use the Apache myfaces implementation of JSF with ADF and facelets, but I keep getting a NoSuchElementException thrown when the pages are accessed.
    Here's the error and stack trace:
    09:15:18,790 INFO [STDOUT] Jan 19, 2006 9:15:18 AM com.sun.facelets.FaceletViewHandler handleRenderException
    SEVERE: Error Rendering View
    java.util.NoSuchElementException
         at java.util.AbstractList$Itr.next(AbstractList.java:426)
         at com.sun.facelets.FaceletViewHandler.encodeRecursive(FaceletViewHandler.java:520)
         at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:450)
         at oracle.adfinternal.view.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:157)
         at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:356)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:325)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:190)
         at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:87)
    09:15:18,790 INFO [STDOUT] Jan 19, 2006 9:15:18 AM com.sun.facelets.FaceletViewHandler handleRenderException
    SEVERE: Took Type: java.io.PrintWriter
    I followed Adam Winer's instructions for incorporating ADF with facelets (using Sun's RI) and this works fine. But when I try to swap out the Sun RI for the Apache myfaces 1.1.1 implementation I get the exception.
    Here's the info from my web.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <display-name>Facelets</display-name>
    <description>Facelets StarterKit</description>
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext*.xml</param-value>
    </context-param>
    <context-param>
    <param-name>facelets.REFRESH_PERIOD</param-name>
    <param-value>2</param-value>
    </context-param>
    <context-param>
    <param-name>facelets.DEVELOPMENT</param-name>
    <param-value>true</param-value>
    </context-param>
    <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
    </context-param>
         <context-param>
              <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
              <param-value>.xhtml</param-value>
         </context-param>
         <context-param>
              <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
              <param-value>true</param-value>
         </context-param>
         <context-param>
              <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
              <param-value>false</param-value>
         </context-param>
         <context-param>
              <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
              <param-value>true</param-value>
         </context-param>
         <context-param>
    <param-name>oracle.adf.view.faces.ALTERNATE_VIEW_HANDLER</param-name>
         <param-value>com.sun.facelets.FaceletViewHandler</param-value>
         </context-param>
         <filter>
         <filter-name>adfFaces</filter-name>
         <filter-class>oracle.adf.view.faces.webapp.AdfFacesFilter</filter-class>
         </filter>
    <filter>
              <filter-name>MyFacesExtensionsFilter</filter-name>
              <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
         <init-param>
         <param-name>maxFileSize</param-name>
         <param-value>20m</param-value>
         </init-param>
         </filter>
         <filter-mapping>
         <filter-name>adfFaces</filter-name>
         <servlet-name>faces</servlet-name>
         </filter-mapping>
         <filter-mapping>
              <filter-name>MyFacesExtensionsFilter</filter-name>
              <url-pattern>*.jsf</url-pattern>
         </filter-mapping>
    <filter-mapping>
    <filter-name>MyFacesExtensionsFilter</filter-name>
    <url-pattern>/faces/*</url-pattern>
    </filter-mapping>
         <listener>
              <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
         </listener>
    <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <listener>
    <listener-class>net.sf.acegisecurity.ui.session.HttpSessionEventPublisher</listener-class>
    </listener>
    <!-- Faces Servlet -->
    <servlet>
    <servlet-name>faces</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
         <!-- resource loader servlet -->
         <servlet>
         <servlet-name>resources</servlet-name>
         <servlet-class>oracle.adf.view.faces.webapp.ResourceServlet</servlet-class>
         </servlet>
    <!-- Faces Servlet Mapping -->
    <servlet-mapping>
    <servlet-name>faces</servlet-name>
    <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
         <servlet-mapping>
         <servlet-name>faces</servlet-name>
         <url-pattern>/faces/*</url-pattern>
         </servlet-mapping>
         <servlet-mapping>
         <servlet-name>resources</servlet-name>
         <url-pattern>/adf/*</url-pattern>
         </servlet-mapping>
    </web-app>
    And in my faces-config.xml, I have set it to use the oracle.adf.core render kit:
    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE faces-config PUBLIC
    "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
    "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config>
    <!-- from project setup -->
    <application>
    <!-- Use the ADF RenderKit -->
    <default-render-kit-id>
    oracle.adf.core
    </default-render-kit-id>
    <variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
    </application>
    <managed-bean>
         <managed-bean-name>keyTable</managed-bean-name>
         <managed-bean-class>example.KeyInfoNodeData</managed-bean-class>
         <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    </faces-config>
    It doesn't seem to matter whether I use <jsp:root xmlns..> tags or <html xmlns ..> tags or whether I use the facelet ui tags or not. I've tried it with several of the ADF components. I always get the pretty facelets exception at the bottom of the page after the ADF component displays.
    Am I missing something? Has anyone gotten these three (ADF w/ myfaces impl and facelets) to work together properly?

    Hi,
    It is supposed to work fine and is working okay, in general, for me. I was setting up a test app yesterday and logged the steps in my blog (http://www.jroller.com/page/mjdenham). I think I logged everything.
    Regards
    Martin

  • Using TopLink with SCM

    Hi!
    I was working with my .mw file with OSCM source control instead of appear this error:
    "An unexpected error has occurred.We are sorry for the inconvenience.
    Messagge:
    EXCEPTION DESCRIPTION: File already exists: [C:\Documents and Settings\mpedretti.DSI\Mis documentos\DocumentosToplink\Carpeta nueva\Table\Nueva 2.xml]
    Stack trace:
    Throwable Class Name:
    oracle.toplink.xml.XMLDataStoreException
    Message:
    EXCEPTION DESCRIPTION: File already exists: [C:\Documents and Settings\mpedretti.DSI\Mis documentos\DocumentosToplink\Carpeta nueva\Table\Nueva 2.xml]
    Stack trace:
    LOCAL EXCEPTION STACK:
    EXCEPTION [TOPLINK-13005] (TopLink - 9.0.3 (Build 423)): oracle.toplink.xml.XMLDataStoreException
    EXCEPTION DESCRIPTION: File already exists: [C:\Documents and Settings\mpedretti.DSI\Mis documentos\DocumentosToplink\Carpeta nueva\Table\Nueva 2.xml]
         at oracle.toplink.xml.XMLDataStoreException.fileAlreadyExists(Unknown Source)
         at oracle.toplink.xml.XMLFileStreamPolicy.getWriteStream(Unknown Source)
         at oracle.toplink.xml.XMLFileStreamPolicy.getNewWriteStream(Unknown Source)
         at oracle.toplink.xml.XMLFileAccessor.getNewWriteStream(Unknown Source)
         at oracle.toplink.xml.XMLAccessorStreamPolicy.getNewWriteStream(Unknown Source)
         at oracle.toplink.xml.XMLInsertCall.getWriteStream(Unknown Source)
         at oracle.toplink.xml.XMLWriteCall.execute(Unknown Source)
         at oracle.toplink.sdk.SDKAccessor.executeCall(Unknown Source)
         at oracle.toplink.publicinterface.UnitOfWork.executeCall(Unknown Source)
         at oracle.toplink.sdk.SDKQueryMechanism.executeCall(Unknown Source)
         at oracle.toplink.sdk.SDKQueryMechanism.executeNoSelectCalls(Unknown Source)
         at oracle.toplink.sdk.SDKQueryMechanism.insertObject(Unknown Source)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(Unknown Source)
         at oracle.toplink.queryframework.InsertObjectQuery.executeCommit(Unknown Source)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.performUserDefinedWrite(Unknown Source)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.performUserDefinedInsert(Unknown Source)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(Unknown Source)
         at oracle.toplink.queryframework.WriteObjectQuery.executeCommit(Unknown Source)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.executeWrite(Unknown Source)
         at oracle.toplink.queryframework.WriteObjectQuery.execute(Unknown Source)
         at oracle.toplink.queryframework.DatabaseQuery.execute(Unknown Source)
         at oracle.toplink.publicinterface.Session.internalExecuteQuery(Unknown Source)
         at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(Unknown Source)
         at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
         at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
         at oracle.toplink.internal.sessions.CommitManager.commitAllObjects(Unknown Source)
         at oracle.toplink.publicinterface.Session.writeAllObjects(Unknown Source)
         at oracle.toplink.publicinterface.UnitOfWork.commitToDatabase(Unknown Source)
         at oracle.toplink.publicinterface.UnitOfWork.commitRootUnitOfWork(Unknown Source)
         at oracle.toplink.publicinterface.UnitOfWork.commitAndResume(Unknown Source)
         at oracle.toplink.workbench.ui.BldrSession.saveProject(Unknown Source)
         at oracle.toplink.workbench.ui.BldrMainView.saveProject(Unknown Source)
         at oracle.toplink.workbench.ui.BldrMainView.saveSelectedProjects(Unknown Source)
         at oracle.toplink.workbench.ui.BldrActionManager$104.actionPerformed(Unknown Source)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.AbstractButton.doClick(Unknown Source)
         at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(Unknown Source)
         at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    This happen when I tried to save the project. Any suggestion??
    What are the best practices to apply SCM using Toplink?
    Thanks!!
    Matias

    Whenever this happens you should be able to do a "file>save as" and save the project in a new directory -- at least you won't be loosing your work.
    Basically I think the problem is either that somehow you corrupted the project with checkin/checkout process, or you did not check out a file that the Mapping Workbench is trying to update when you save the project.
    10g Mapping Workbench, I have heard, is going to have more intelligence in the area and note ahead of time which files need to be checked out when you save your project. I think a developer preview will be available any day now, keep your eyes peeled to the OTN webpage for TopLink.
    The mapping workbench reference guide has a couple pages that talk about how to use it with SCM systems. In TopLink 903 these docs are shipped with TopLink. See page 1-11 for more info.

  • How do I use toplink with Spring 2.5 and oc4j 10.1.2?

    Our existing java server environment is limited to Oc4j 10.1.2 due to being tied to Oracle Forms.
    We've added a java 6 jdk to the machine and linked it to a specific container to examine some newer java features since this version of the application server only comes with java 1.4.2.
    Does anyone have some configuration steps for getting toplink essentials and spring to work with oc4j 10.1.2? Even with oc4j 10.1.3 in jdev 10.1.3.4 I'm having problems trying to figure out what needs placed in the persistence.xml file verses what needs placed in the spring-beans.xml file.
    I'm trying to either use the J2SE option of keeping the connection information in the persistence.xml file (which doesn't work) - it tries to connect to //localhost:1521/orcl. If I try to define a datasource within Spring's xml file, I'm not sure how to tie that into the persistence.xml file. Could I use the oc4j 10.1.2 container provided datasource?
    It seems like I'm at a loss as to how to get this working. If you'd like me to post some files, I can do that later on today when I get back to work.
    The configuration that I'm trying to do is based on a modified workspace from an ibm developerworks article with websphere, mixing in the ideas from a JPA with Spring 2.0 article from Mike Keith and Rod Johnson. (That article goes pretty far in the configuration information but never provided an example to download...)
    Any help appreciated.
    Eric (hbg, pa)

    I'm still at a loss with this. Rather than worry about the older version, for now, I just want to see JPA in action. So, I've decided on just running the Spring 2.5.6 petclinic example out of the samples folder. When I try to do this, after only tweaking the web.xml to use the applicationContext-jpa.xml file, the application does not initialize properly. Here's the stack trace I get:
    Target URL -- http://192.168.0.2:8988/petclinic/index.jsp
    09/05/11 23:26:05 Oracle Containers for J2EE 10g (10.1.3.4.0)  initialized
    WARNING: Code-source C:\javalib\spring-2.5.6\samples\petclinic\war\WEB-INF\lib\connector.jar (from WEB-INF/lib/ directory in C:\javalib\spring-2.5.6\samples\petclinic\war\WEB-INF\lib) has the same filename but is not identical to /C:/jdev10134/j2ee/home/lib/connector.jar (from <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in C:\jdev10134\j2ee\home\oc4j.jar). If it contains different versions of the same classes, it will be masked as the latter is already visible in the search path of loader current-workspace-app.web.petclinic:0.0.0.
    WARNING: Code-source C:\javalib\spring-2.5.6\samples\petclinic\war\WEB-INF\lib\jta.jar (from WEB-INF/lib/ directory in C:\javalib\spring-2.5.6\samples\petclinic\war\WEB-INF\lib) has the same filename but is not identical to /C:/jdev10134/j2ee/home/lib/jta.jar (from <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in C:\jdev10134\j2ee\home\oc4j.jar). If it contains different versions of the same classes, it will be masked as the latter is already visible in the search path of loader current-workspace-app.web.petclinic:0.0.0.
    WARNING: Code-source C:\javalib\spring-2.5.6\samples\petclinic\war\WEB-INF\lib\persistence.jar (from WEB-INF/lib/ directory in C:\javalib\spring-2.5.6\samples\petclinic\war\WEB-INF\lib) has the same filename but is not identical to /C:/jdev10134/j2ee/home/lib/persistence.jar (from <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in C:\jdev10134\j2ee\home\oc4j.jar). If it contains different versions of the same classes, it will be masked as the latter is already visible in the search path of loader current-workspace-app.web.petclinic:0.0.0.
    WARNING: Code-source C:\javalib\spring-2.5.6\samples\petclinic\war\WEB-INF\lib\toplink-essentials.jar (from WEB-INF/lib/ directory in C:\javalib\spring-2.5.6\samples\petclinic\war\WEB-INF\lib) has the same filename but is not identical to /C:/jdev10134/toplink/jlib/toplink-essentials.jar (from <code-source> in /C:/jdev10134/jdev/system/oracle.j2ee.10.1.3.42.70/embedded-oc4j/config/server.xml). If it contains different versions of the same classes, it will be masked as the latter is already visible in the search path of loader current-workspace-app.web.petclinic:0.0.0.
    09/05/11 23:26:24 log4j: Parsing for [root] with value=[INFO, stdout].
    09/05/11 23:26:24 log4j: Level token is [INFO].
    09/05/11 23:26:24 log4j: Category root set to INFO
    09/05/11 23:26:24 log4j: Parsing appender named "stdout".
    09/05/11 23:26:24 log4j: Parsing layout options for "stdout".
    09/05/11 23:26:24 log4j: Setting property [conversionPattern] to [%d %p [%c] - <%m>%n].
    09/05/11 23:26:24 log4j: End of parsing for "stdout".
    09/05/11 23:26:24 log4j: Parsed "stdout" options.
    09/05/11 23:26:24 log4j: Parsing for [org.springframework.samples.petclinic.aspects] with value=[DEBUG].
    09/05/11 23:26:24 log4j: Level token is [DEBUG].
    09/05/11 23:26:24 log4j: Category org.springframework.samples.petclinic.aspects set to DEBUG
    09/05/11 23:26:24 log4j: Handling log4j.additivity.org.springframework.samples.petclinic.aspects=[null]
    09/05/11 23:26:24 log4j: Finished configuring.
    09/05/11 23:26:24 log4j: Reading configuration from URL file:/C:/javalib/spring-2.5.6/samples/petclinic/war/WEB-INF/classes/log4j.properties
    09/05/11 23:26:24 log4j: Parsing for [root] with value=[INFO, stdout].
    09/05/11 23:26:24 log4j: Level token is [INFO].
    09/05/11 23:26:24 log4j: Category root set to INFO
    09/05/11 23:26:24 log4j: Parsing appender named "stdout".
    09/05/11 23:26:24 log4j: Parsing layout options for "stdout".
    09/05/11 23:26:24 log4j: Setting property [conversionPattern] to [%d %p [%c] - <%m>%n].
    09/05/11 23:26:24 log4j: End of parsing for "stdout".
    09/05/11 23:26:24 log4j: Parsed "stdout" options.
    09/05/11 23:26:24 log4j: Parsing for [org.springframework.samples.petclinic.aspects] with value=[DEBUG].
    09/05/11 23:26:24 log4j: Level token is [DEBUG].
    09/05/11 23:26:24 log4j: Category org.springframework.samples.petclinic.aspects set to DEBUG
    09/05/11 23:26:24 log4j: Handling log4j.additivity.org.springframework.samples.petclinic.aspects=[null]
    09/05/11 23:26:24 log4j: Finished configuring.
    2009-05-11 23:26:24,593 INFO [org.springframework.web.context.ContextLoader] - <Root WebApplicationContext: initialization started>
    2009-05-11 23:26:24,687 INFO [org.springframework.web.context.support.XmlWebApplicationContext] - <Refreshing org.springframework.web.context.support.XmlWebApplicationContext@eeb406: display name [Root WebApplicationContext]; startup date [Mon May 11 23:26:24 EDT 2009]; root of context hierarchy>
    2009-05-11 23:26:24,828 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - <Loading XML bean definitions from ServletContext resource [WEB-INF/applicationContext-jpa.xml]>
    2009-05-11 23:26:25,281 INFO [org.springframework.web.context.support.XmlWebApplicationContext] - <Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@eeb406]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1da817b>
    2009-05-11 23:26:25,734 INFO [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] - <Loading properties file from class path resource [jdbc.properties]>
    2009-05-11 23:26:25,796 INFO [org.springframework.context.weaving.DefaultContextLoadTimeWeaver] - <Determined server-specific load-time weaver: org.springframework.instrument.classloading.oc4j.OC4JLoadTimeWeaver>
    2009-05-11 23:26:28,296 INFO [org.springframework.web.context.support.XmlWebApplicationContext] - <Bean 'org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter#c25ae3' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)>
    2009-05-11 23:26:28,359 INFO [org.springframework.web.context.support.XmlWebApplicationContext] - <Bean 'dataSource' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)>
    2009-05-11 23:26:28,437 INFO [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] - <Building JPA container EntityManagerFactory for persistence unit 'PetClinic'>
    2009-05-11 23:26:28,468 INFO [org.springframework.web.context.support.XmlWebApplicationContext] - <Bean 'entityManagerFactory' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)>
    2009-05-11 23:26:28,562 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1da817b: defining beans [org.springframework.context.weaving.AspectJWeavingEnabler#0,org.springframework.context.config.internalBeanConfigurerAspect,loadTimeWeaver,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,dataSource,entityManagerFactory,transactionManager,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.transaction.config.internalTransactionAspect,org.springframework.samples.petclinic.aspects.UsageLogAspect#0,org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0,clinic]; root of factory hierarchy>
    2009-05-11 23:26:29,671 INFO [org.springframework.web.context.ContextLoader] - <Root WebApplicationContext: initialization completed in 5078 ms>
    2009-05-11 23:26:29,734 INFO [org.springframework.web.servlet.DispatcherServlet] - <FrameworkServlet 'petclinic': initialization started>
    2009-05-11 23:26:29,734 INFO [org.springframework.web.context.support.XmlWebApplicationContext] - <Refreshing org.springframework.web.context.support.XmlWebApplicationContext@c00e55: display name [WebApplicationContext for namespace 'petclinic-servlet']; startup date [Mon May 11 23:26:29 EDT 2009]; parent: org.springframework.web.context.support.XmlWebApplicationContext@eeb406>
    2009-05-11 23:26:29,734 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - <Loading XML bean definitions from ServletContext resource [WEB-INF/petclinic-servlet.xml]>
    2009-05-11 23:26:30,171 INFO [org.springframework.web.context.support.XmlWebApplicationContext] - <Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@c00e55]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1c5543b>
    2009-05-11 23:26:30,375 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1c5543b: defining beans [addOwnerForm,addPetForm,addVisitForm,clinicController,editOwnerForm,editPetForm,findOwnersForm,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#0,org.springframework.web.servlet.view.InternalResourceViewResolver#0,messageSource]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@1da817b>
    2009-05-11 23:26:31,828 INFO [org.springframework.web.servlet.DispatcherServlet] - <FrameworkServlet 'petclinic': initialization completed in 2094 ms>
    May 11, 2009 11:26:58 PM oracle.toplink.essentials.session.file:/C:/javalib/spring-2.5.6/samples/petclinic/war/WEB-INF/classes/-PetClinic.transaction
    WARNING: PersistenceUnitInfo PetClinic has transactionType RESOURCE_LOCAL and therefore jtaDataSource will be ignored
    May 11, 2009 11:26:58 PM oracle.toplink.essentials.session.file:/C:/javalib/spring-2.5.6/samples/petclinic/war/WEB-INF/classes/-PetClinic
    INFO: TopLink, version: Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))
    May 11, 2009 11:26:58 PM oracle.toplink.essentials.session.file:/C:/javalib/spring-2.5.6/samples/petclinic/war/WEB-INF/classes/-PetClinic
    INFO: Server: unknown
    May 11, 2009 11:26:58 PM oracle.toplink.essentials.session.file:/C:/javalib/spring-2.5.6/samples/petclinic/war/WEB-INF/classes/-PetClinic.connection
    CONFIG: connecting(DatabaseLogin(
            platform=>EssentialsHSQLPlatformWithNativeSequence
            user name=> ""
            connector=>JNDIConnector datasource name=>null
    May 11, 2009 11:27:03 PM oracle.toplink.essentials.session.file:/C:/javalib/spring-2.5.6/samples/petclinic/war/WEB-INF/classes/-PetClinic
    SEVERE:
    Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
    Error Code: 17002
            at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:305)
            at oracle.toplink.essentials.jndi.JNDIConnector.connect(JNDIConnector.java:150)
            at oracle.toplink.essentials.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:184)
            at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:233)
            at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.connect(DatabaseAccessor.java:242)
            at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:309)
            at oracle.toplink.essentials.threetier.ConnectionPool.buildConnection(ConnectionPool.java:117)
            at oracle.toplink.essentials.threetier.ExternalConnectionPool.startUp(ExternalConnectionPool.java:135)
            at oracle.toplink.essentials.threetier.ServerSession.connect(ServerSession.java:451)
            at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:616)
            at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:282)
            at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:229)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:93)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:126)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:120)
            at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:91)
            at org.springframework.orm.jpa.JpaTransactionManager.createEntityManagerForTransaction(JpaTransactionManager.java:392)
            at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:320)
            at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
            at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
            at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:220)
            at org.springframework.transaction.aspectj.AbstractTransactionAspect.ajc$before$org_springframework_transaction_aspectj_AbstractTransactionAspect$1$2a73e96c(AbstractTransactionAspect.aj:63)
            at org.springframework.samples.petclinic.jpa.EntityManagerClinic.getVets(EntityManagerClinic.java:39)
            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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
            at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:138)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
            at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
            at $Proxy19.getVets(Unknown Source)
            at org.springframework.samples.petclinic.web.ClinicController.vetsHandler(ClinicController.java:53)
            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.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:421)
            at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:136)
            at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:326)
            at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:313)
            at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
            at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
            at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
            at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
            at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
            at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
            at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
            at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
            at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
            at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
            at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
            at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
            at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234)
            at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29)
            at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879)
            at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
            at java.lang.Thread.run(Thread.java:595)
    Caused by: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
            at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
            at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:175)
            at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:287)
            at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:328)
            at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:430)
            at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:151)
            at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
            at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:608)
            at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:218)
            at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection(OracleConnectionPoolDataSource.java:114)
            at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:77)
            at oracle.jdbc.pool.OracleImplicitConnectionCache.makeCacheConnection(OracleImplicitConnectionCache.java:1361)
            at oracle.jdbc.pool.OracleImplicitConnectionCache.getCacheConnection(OracleImplicitConnectionCache.java:441)
            at oracle.jdbc.pool.OracleImplicitConnectionCache.getConnection(OracleImplicitConnectionCache.java:336)
            at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:286)
            at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:179)
            at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:159)
            at oracle.oc4j.sql.DataSourceConnectionPoolDataSource.getPooledConnection(DataSourceConnectionPoolDataSource.java:57)
            at oracle.oc4j.sql.xa.EmulatedXADataSource.getXAConnection(EmulatedXADataSource.java:92)
            at oracle.oc4j.sql.spi.ManagedConnectionFactoryImpl.createXAConnection(ManagedConnectionFactoryImpl.java:211)
            at oracle.oc4j.sql.spi.ManagedConnectionFactoryImpl.createManagedConnection(ManagedConnectionFactoryImpl.java:170)
            at com.evermind.server.connector.ApplicationConnectionManager.createManagedConnection(ApplicationConnectionManager.java:1398)
            at oracle.j2ee.connector.ConnectionPoolImpl.createManagedConnectionFromFactory(ConnectionPoolImpl.java:327)
            at oracle.j2ee.connector.ConnectionPoolImpl.access$800(ConnectionPoolImpl.java:98)
            at oracle.j2ee.connector.ConnectionPoolImpl$NonePoolingScheme.getManagedConnection(ConnectionPoolImpl.java:1211)
            at oracle.j2ee.connector.ConnectionPoolImpl.getManagedConnection(ConnectionPoolImpl.java:785)
            at oracle.oc4j.sql.ConnectionPoolImpl.getManagedConnection(ConnectionPoolImpl.java:45)
            at com.evermind.server.connector.ApplicationConnectionManager.getConnectionFromPool(ApplicationConnectionManager.java:1596)
            at com.evermind.server.connector.ApplicationConnectionManager.acquireConnectionContext(ApplicationConnectionManager.java:1541)
            at com.evermind.server.connector.ApplicationConnectionManager.allocateConnection(ApplicationConnectionManager.java:1486)
            at oracle.j2ee.connector.OracleConnectionManager.unprivileged_allocateConnection(OracleConnectionManager.java:238)
            at oracle.j2ee.connector.OracleConnectionManager.allocateConnection(OracleConnectionManager.java:192)
            at oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:272)
            at oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:200)
            at oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:142)
            at oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:127)
            at oracle.toplink.essentials.jndi.JNDIConnector.connect(JNDIConnector.java:145)
            ... 60 moreAny ideas? I'd really like to see JPA, Spring and oc4j working together?
    Thanks,
    Eric

  • Need advise for best practice when using Toplink with external transaction

    Hello;
    Our project is trying to switch from Toplink control transaction to using External transaction so we can make database operation and JMS operation within a single transaction.
    Some of our team try out the Toplink support for external transaction and come up with the following initial recommendation.
    Since we are not familar with using external transaction, I would like member of this forum and experts, to help comment on whether these recommendation are indeed valid or in line with the best practice. And for folks that have done this in their project, what did you do ?
    Any help will be most appreciated.
    Data Access Objects must be enhanced to support reading from a TOPLink unit of work when using an external transaction controller. Developers must consider what impact a global transaction will have on the methods in their data access objects (DAOs).
    The following findSomeObject method is representative of a “finder” in the current implementation of our DAOs. It is not especially designed to execute in the context of a global transaction, nor read from a unit of work.
    public findSomeObject(ILoginUser aUser, Expression queryExpression)
    ClientSession clientSession = getClientSession(aUser);
    SomeObject obj = null;
    try
    ReadObjectQuery readObjectQuery = new ReadObjectQuery(SomeObject.class);
    readObjectQuery.setSelectionCriteria(queryExpression);
    obj = (SomeObject)clientSession.executeQuery(readObjectQuery);
    catch (DatabaseException dbe)
    // throw an appropriate exception
    finally
    clientSession.release();
    if (obj == null)
    // throw an appropriate exception
    return obj;
    However, after making the following changes (in blue) the findSomeObject method will now read from a unit of work while executing in the context of a global transaction.
    public findSomeObject(ILoginUser aUser, Expression queryExpression)
    Session session = getClientSession(aUser);
    SomeObject obj = null;
    try
    ReadObjectQuery readObjectQuery = new ReadObjectQuery(SomeObject.class);
    readObjectQuery.setSelectionCriteria(queryExpression);
    if (TransactionController.getInstance().useExternalTransactionControl())
         session = session.getActiveUnitOfWork();
         readObjectQuery.conformResultsInUnitOfWork(); }
    obj = (SomeObject)session.executeQuery(readObjectQuery);
    catch (DatabaseException dbe)
    // throw an appropriate exception
    finally
    if (TransactionController.getInstance().notUseExternalTransactionControl())
         session.release();
    if (obj == null)
    // throw an appropriate exception
    return obj;
    When getting the TOPLink client session and reading from the unit of work in the context of a global transaction, new objects need to be cached.
    public getUnitOfWork(ILoginUser aUser)
    throws DataAccessException
         ClientSession clientSession = getClientSession(aUser);
         UnitOfWork uow = null;
         if (TransactionController.getInstance().useExternalTransactionControl())
              uow = clientSession.getActiveUnitOfWork();
              uow.setShouldNewObjectsBeCached(true);     }
         else
              uow = clientSession.acquireUnitOfWork();
         return uow;
    }

    As it generally is with this sort of question there is no exact answer.
    The only required update when working with an External Transaction is that getActiveUnitOfWork() is called instead of acquireUnitOfWork() other than that the semantics of the calls and when you use a UnitOfWork is still dependant on the requirements of your application. For instance I noticed that originally the findSomeObject method did not perform a transactional read (no UnitOfWork). Has the requirements for this method changed? If they have not then there is still no need to perform a transactional read, and the method would not need to change.
    As for the requirement that new object be cached this is only required if you are not conforming the transactional queries and adds a slight performance boost for find by primary key queries. In order to use this however, objects must be assigned primary keys by the application before they are registered in the UnitOfWork.
    --Gordon                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Using Toplink with Eclipse - (Newbie question)

    If you have (for instance):
    * a blank Dynacmic Web Project in Eclipse
    * and you have a Workbench Toplink project- say an XML or Database project.
    Then you have to save your Toplink project, which spurts out various directories e.g. classes, descriptors, schemas, fooname.mwp etc.
    Where do you save this in your Java project - is it at /src? Or someplace else?
    I am asking this question because I am having problems when debugging my application - certain xml files cannot be found etc. Anyway I guess I just need to find out if I am getting the basics right for now - so any help will be much appreciated.
    PS - Why can't I find a simple tutorial/example showing Eclipse and Toplink - it's all JDeveloper and Ant builds and ahhhhhghghhhgh!

    golcarlad,
    Hi, try the following EclipseLink JPA examples and tutorials for SE and EE environments - oriented around the Eclipse 3.4 IDE (ant capable but WTP ready)
    With these you will be able to fully debug your JPA application both on and off any application server.
    If you are still deploying your WAR to Tomcat then the following tutorial on running EclipseLink JPA on Tomcat 6 will help you out. Put your additional orm.xml file alongside persistence.xml if you are using functionality beyond standard JPA.
    http://wiki.eclipse.org/EclipseLink/Examples/JPA/Tomcat_Web_Tutorial
    From
    Help on creating a ServerSession in Eclipse with XML file
    "In particular note that there are two META-INF directories - we want to use only the one off of src.
    "Make sure that your persistence.xml (and optionaly orm.xml) file is placed off of the src/META-INF directory and not the default WebContent/META-INF dir so that it gets picked up by the servlet classloader from the classes directory."
    Other Tutorials:
    http://wiki.eclipse.org/EclipseLink/Examples
    http://wiki.eclipse.org/EclipseLink/Examples/JPA
    http://wiki.eclipse.org/EclipseLink/Examples/JPA/EmployeeXML
    http://wiki.eclipse.org/EclipseLink/Examples/JPA/Dynamic
    http://wiki.eclipse.org/EclipseLink/Examples/JPA#JPA_Web_Application_Tutorials
    http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial
    http://wiki.eclipse.org/EclipseLink/Examples/JPA/OC4J_Web_Tutorial
    http://wiki.eclipse.org/EclipseLink/Examples/JPA/JBoss_Web_Tutorial
    thank you
    /michael
    Edited by: michael_obrien on Mar 19, 2009 9:19 AM

  • Using Toplink with Oracle Spatial (missing right parenthesis error)

    Hi,
    I always get the following error when I try to create spatial query with toplink.
    Internal Exception: java.sql.SQLException: ORA-00907: missing right parenthesis
    Any idea ? Also, there is no trace of my point in the generated sql....
    Here is the generated query:
    SELECT ID, [...]
    FROM QUEBEC_CITY
    WHERE (MDSYS.SDO_NN(GEOMETRY, JGeometry (gtype=1, dim=2, rid=8307, NULL) = 'TRUE')
    ORDER BY ID ASC
    Here is my code... :
    double[] coord = new double[]{-71.25163d, 46.8527d};
    JGeometry point = JGeometry.createPoint(coord, 2, 8307);
    SpatialOperator nearestNeighbor = SpatialOperator.nearestNeighbor(session);
    ReadAllQuery query = new ReadAllQuery(UrbanEdgeDescriptor.class);
    ExpressionBuilder eb = query.getExpressionBuilder();
    Expression geom = eb.get("geometry");
    query.setSelectionCriteria(nearestNeighbor.buildExpression(geom, point));
    query.addAscendingOrdering("id");
    List<UrbanEdgeDescriptor> results = (List)db.getSession().executeQuery(query);
    System.out.println(results!=null);

    The problem is the toString() on JGeometry. It does not print out a complete description the database can use inline. It produces:
    JGeometry (gtype=1, dim=2, rid=8307
    To get JGeometry types to work in your queries the easiest solution is to use parameter binding so the literal representation is not used.
    Doug

  • Using Toplink with Servlets in a Clustered application server

    I am having some problems with Toplink.
    Basically, I have a collection of HttpServlets that manipulate a domain object and its various collections of objects. The general technique is to place the domain object in the HttpSession, and have each Servlet modify this object by retrieving it, modifying it, and storing it when necessary. The problem is that since this application is running in a clustered environment, the object in the session may or may not be the same object returned from Toplink. It may be a serialized clone of the object from another server on the cluster.
    This has caused several problems. First, if I am using indirction for the collections, when the domain object is deserializaed, it throws an exception when it tries to instantiate the indirection. Next, when trying to store the object, it is not registered with a unit of work, and I am not sure how to properly account for this. Third, there is a many to many relationship. The user may pick one such object, and add it to the domain object being manipulated. This seems to cause problems when the object is read from Toplink, and added to the domain object that is a serialized clone.
    Anyway, my question is, what is the general pattern for handling an object being manipulated on a HttpSession in a clustered environment, where this object(s) may or may not be the actual objects returned from Toplink? My goal is to have a factory return one DatabaseSession per cluster server, and be able to load, store, and manipulate these objects in the HttpSession.
    Here is an attempt at code:
    import java.io.*;
    import java.util.*;
    import oracle.toplink.expressions.*;
    import oracle.toplink.sessions.*;
    public class DataAccess
    private static Project project = new MyToplinkProject();
    private static DatabaseSession session;
    private UnitOfWork unit;
    public DataAccess()
    unit = getDatabaseSession().acquireUnitOfWork();
    public ArrayList getAllCustomers()
    Vector v = (Vector) session.readAllObjects(Customer.class);
    return new ArrayList(v);
    public Customer getCustomerForUpdate(Customer c)
    Customer custCopy = (Customer) unit.readObject(c);
    return (Customer) unit.registerObject(c);
    public Form getCustomer(String id)
    ExpressionBuilder builder = new ExpressionBuilder();
    Expression exp = builder.get("id").equal(id);
    return (Customer) session.readObject(Customer.class, exp);
    public void saveCustomer(Customer cust)
    unit.deepMergeClone(cust);
    unit.commitAndResume();
    private synchronized DatabaseSession getDatabaseSession()
    if (session == null)
    session = project.createDatabaseSession();
    session.login();
    session.setLog(new PrintWriter(System.out));
    session.logMessages();
    return session;
    public void destruct()
    release();
    public void release()
    unit.release();
    session.release();
    Anyway, from this code I hope you can see what I am trying to do. The basic idea is that a Customer object provided for store and update may or may not be a serialized copy. Also, the object returned from a read may be serialized before the indirction is attempted.
    Thanks for any help,
    Jason Wilson

    Hi Jason
    A single static DatabaseSession and a single static UnitOfWork is not the recommended way of working with TopLink from a servlet. Our recommendation is that you create a single ServerSession object and that every time a servlet needs to interact with a TopLink Session, the servlet first acquires a ClientSession from this ServerSession object and possibly acquires UnitOfWork from the ClientSession. A UnitOfWork is not intended to be shared by servlets, or by different clients.
    Basically, what you're attempting to do with the DatabaseSession is something we would recommend that you do instead with a ServerSession/ClientSessions combination.
    As for working with persistent objects that you store in an HttpSession, I will try to give you some relevant background. First off, the UnitOfWork is intended to be used to manage the changes to a set of objects in a SINGLE TRANSACTION. It is always much easier to manage if these transactions are short-lived (ie if there is one transaction per ServletRequest.
    However, the fact that you are talking about storing objects in the HttpSession makes me think that you are also considering long-running transactions that are may be spread out over several ServletRequests. You should definately consider this decision very carefully. If you want to continually edit an object that is stored in the HttpSession, then we need to consider how to manage when the object's changes should be committed to the database and how to manage concurrency when two users have the same object in their respective HttpSession objects.
    One idea is not to store the actual object in the HttpSession but instead to store the "id" of the object (something that you can use to find the correct object when the same user makes another request). So servlets always:
    -acquireClientSession
    -find the object that they are working with (based on information in the HttpSession)
    -if the object is to be edited then a UnitOfWork provides clones of the object (this isolates you from changes that some other user makes to the same object)
    -at the end, commit the changes to the object.
    When the user makes another request, the object they read will have their changes. So, functionally, this is the same as storing the actual object in the HttpSession, except TopLink can provide proper ACID behavior for any updates that you decide to make. And don't worry about the added "expense" of having to query at the beginning of each servlet request; if you are storing the "id" of the object in your HttpSession, then you a simple cache hit is all that is required to get back the correct object. You don't have to go the database at all.
    JIM

  • Maximum number of columns allowed using Toplink in ADF

    Hi All,
    I am working on Toplink using ADF.
    When Iam displaying a table which is having more than 120 columns I am unable to get the output.
    Is there any limitation for the number of columns that we can display. Could any one please suggest me if there is any solution for this problem.
    Thanking You in advance.
    Satish.

    Assuming you are referring to 9iR2,
    http://download.oracle.com/docs/cd/B10501_01/server.920/a96536/ch44.htm#288033

  • Using Toplink with JSF

    This kind of crosses the boundaries of 2 forms. And since I'm not getting much response over in JDev perhaps this forums residents could help shed some light on the problem:
    Updating Toplink objects with JSF

    Thanks for bringing the thread to my attention. Keeping an eye on all the forums is challenging and occasionally we miss TopLink specific questions in the other forums. I have posted a response looking for more information on the original thread.
    Doug

  • How to implement the pessimistic locking using toplink with sybase

    we want to allocate the unique primary key to each row when many user try to insert the records concurrently..So what we are trying to do is we calculate the maximum of Primary Key and incremented it by 1. Now we want to Apply the locking concept on the so that unique key will be allocated to each newly inserted row
    Can you please tell me
    1. how we can genrate unique primary key in toplink using sybase?
    2.how to implement the pessimistic or optimistic locking ?which one will be preferable?

    Hi brother
    I think that this link can help you
    http://download-east.oracle.com/docs/cd/A97688_16/toplink.903/b10064/database.htm#1007986
    Good luck

  • How-to use captcha with ADF Faces 10g (10.1.3)

    Hi All,
    Could You Pls tell me how to use the captcha using 10g currently i am using the jdeveloper version of 10.1.3. I have found the link for using the *[captcha using 11g|http://www.oracle.com/technology/products/jdev/tips/fnimphius/captcha/captcha.html]* but some of the components here such as af:panelFormLayout and af:panelGroupLayout are not available in 10g.Are there are any alternative components Availablel for the 10g
    regards
    Yeshwant

    Hi John ,
    Thankx for the reply ..
    i am getting the following compilation error *(Error: Attribute: halign is not a valid attribute name)* while doing that .
    i have written the code as follows...
    <f:view>
    <af:document id="d1">
    <af:form id="f1">
    <af:panelForm id="pfl1">
    <f:facet name="footer"/>
    <af:objectImage source="/captchaservlet" id="i1"
    inlineStyle="width:251px; height:76.0px;"/>
    <af:commandButton text="can't read image" id="cb2"
    partialSubmit="false"/>
    <af:panelLabelAndMessage label="Are U a robot?" id="plam1">
    <af:panelGroup id="pgl1" layout="horizontal" halign="left">
    <af:inputText id="it1" value="#{requestScope.bestGuess}"/>
    <af:commandButton text="try" id="cb1"
    actionListener="#{HandleCaptchaBean.verifyAnswer}"
    partialSubmit="true" immediate="false"/>
    </af:panelGroup>
    <af:message id="m1" messageType="info" for="it1"/>
    </af:panelLabelAndMessage>
    </af:panelForm>
    </af:form>
    </af:document>
    </f:view>
    Thankx
    Regards
    Yeshwant

  • Singel Table Maintenance Cookbook with ADF/Toplink

    Hi All.
    I've got a rather large project to do at the moment (with the usual impossible deadline), and my boss insists that we have to use at least toplink but preferably toplink with ADF Faces on top of it. All the examples that I've found however are of the master detail display type.
    Are there any resources out there for showing how to do a single table maintenance type application using this technology? I have about 20+ tables of data that have to be maintained individually by various users for my system to work.
    Any thoughts/ideas/wild speculations would be greatly appreciated.
    Kind regards
    Elmar Matthee
    Stellenbosch University
    South Africa

    After you went through the tutorial, your next step is to read the ADF Developer Guide book on the same page (if you want a hard copy of this book you can get it on the oracle store, or just print the PDFs).
    http://www.oracle.com/technology/products/adf/learnadf.html
    There you will find things like adding validation and handling errors explained in more details.
    And it will also explain how the "ton of code/xml/jsp pages that all interact in very misterious ways" actually work and what each file is doing.
    Basically the xml files describe to the framework how your data controls are structured and also how your pages use the data-controls. These XML files are what saves you all the coding.
    Regarding changes in the database, if you are using ADF Business Components then there is a reconcile with database option for your EOs. If you are using TopLink you'll need to manually add/remove the new column to the class and then use the mapping editor to update its mappping to your database object.
    And I don't think your assesment that the development environment is very fragile is true. We have many customers using this environment to build production applications, so if you have a specific bug you that you encountered we'll be interested to know what it is.

Maybe you are looking for