Lazy loading differences Toplink vs. Hibernate - plz. explain

I'm in the process of evaluating both Toplink and hibernate as potential ORM framework to use for a project I'm currently involved in.
My question is about how Toplink resolves lazily loaded associations. In hibernate I have to perform a query inside a transactional context boundary, like:
Session s = SessionFactory.getSession();
s.beginTransaction();
... your query logic here
s.getTransaction().commit();When the query involves associations which are declared as lazily loadable, trying to invoke these associations after the transaction boundary has been closed, results in an exception. This differs from Toplink (my JUnit testcase breaks for Hibernate if I set the DAOFactory to return hibernate enabled DAO's) and I'm wondering why?
I'm guessing this has something to do with how Toplink manages its clientsession, but would like to get some confirmation about this. It looks like as-long as the thread of execution is running I can resolve associations using Toplink, but not when I use Hibernate.
This brings me to yet another question - what's considered best practices in Toplink regarding session disposal. Should I do something myself, or let the garbage collector take care of it?

I'm not too sure here, but I think it's because TopLink has a "long running" ServerSession. When you do lazy initialization outside a clientsession it is for read only purposes and it will use the centrally managed ServerSession (and cache). I'm still trying to figure out the exact relationships here, som I'm not too sure. :) Hibernate does not have a centrally shared cache, and will not be able to instantiate objects if the session is closed (for each session, objects are instantiated from it's data cache).
As for handling resources and closing/opening, use the Spring/TopLink integration. It will handle it for you and give you heaps of convenience methods that uses some clever tricks to decide if it should fetch objects with Session or UnitOfWork. It will also do some good Exception handling built into Spring.

Similar Messages

  • It doesn�t work lazy loading with remote client (toplink)

    I am trying to use lazy loading in a @ManyToOne field but I get an exception. I have been reading in some oracle tutorials that it's necesary use -javaagent:.../lib/toplink-essentials-agent.jar for that it works because this argument activate dynamic weaving in JavaSE. I have put this command line argument javaagent but it doesn't work. Why? Can I have to do another thing? I have done a lot of tests in base to comments read in another forums but I only obtains an exception.
    Caused by: java.io.IOException: Mismatched serialization UIDs
    NOTE: The server use toplink and the remote client query the entitties through a session bean of the server. Besides, I am using Glassfish (Sun application server and toplink).
    Thanks in advance.
    hayken

    At first, thank you for your reply.
    I know that I haven´t explained the problem too well. I have a stateless bean with one remote method that execute a query an returns an entity like this
    @Entity
    public class ModuloEntity extends Serializable
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long idModulo;
    private String nombre;
    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="IdProyecto")
    private ProyectoEntity proyecto;
    The remote client invoke this method and in that moment I get this exception.
    21-may-2007 18:55:48 com.sun.corba.ee.impl.encoding.CDRInputStream_1_0 read_value
    ADVERTENCIA: "IOP00810211: (MARSHAL) Exception from readValue on ValueHandler in CDRInputStream"
    org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 211 completed: Maybe
    at com.sun.corba.ee.impl.logging.ORBUtilSystemException.valuehandlerReadException(ORBUtilSystemException.java:7053)
    Caused by: java.io.IOException: Mismatched serialization UIDs : Source (Rep. IDRMI:com.syskonic.gesplan.entities.ModuloEntity:6D06A8C14D488FFF:8E6FC8687EA9E512) = 8E6FC8687EA9E512 whereas Target (Rep. ID RMI:com.syskonic.gesplan.entities.ModuloEntity:1C6925798CDFD3DF:3455DBF4457AE337) = 3455DBF4457AE337
    at com.sun.corba.ee.impl.util.RepositoryId.useFullValueDescription(RepositoryId.java:573)
    If I look the server log, I can see that the call has not been produced, it doesn´t show any exception. It looks that the object managed by the server and the remote client aren´t the same and the corba service doesn´t work when remote client call session method. If I change the ModuloEntity and remove the fetch attribute then all this process executes correctly. The problem is in this attribute.
    NOTE: I am using the javaagent command line argument.
    Hayken

  • Toplink JPA LAZY loading in Java SE works without javaagent?

    hi there,
    I tought that mappings like
    @JoinColumn(name = "join_col_name")
    @ManyToOne(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
    private RelatedObject relObj;
    with TopLink JPA in Java SE environment works ONLY with the
    -javaagent:toplink-essentials-agent.jar
    JVM parameter?
    the strange thing is: I did 2 test runs, with and without the java agent parameter. I also could see that in the first case the weaver is working, in the second the property "toplink.weaving=false" is printed to the console BUT if I access the LAZY mapped attribute of the object instance it works in both cases - I expected a NullPointerEx. in the case without the javaagent.
    Is there anything I missed?
    Hans

    Chris,
    thank for for the tip about verifying lazy or eager fetching. The results are interesting - or better: confusing - to me:
    I have built a test project with 3 entities:
    Entity A hast @OneToMany to Entity B and
    Entity B has ManyToONe to Entity C
    A <-- B --> C
    ALL relations are marked with FetchType.LAZY in all directions.
    When I simply run the test project via main()-method out of eclipse, WITHTOUT specifycing a -javaagent parameter in the run dialog, I can confirm using your test case that the realtion IS LAZILY FETCHED.
    So, I do not really know how this should work without the javaagent.
    You mentioned statically weaved classed - is this the default case when no agent is present, how is it done? Toplink logging says that weaving is NOT active:
    ServerSession(16821027)--Thread(Thread[main,5,main])--property=toplink.weaving; value=false
    so how can the lazy loading work then?
    regards,
    Hans

  • Toplink.weaving=true gives PersistenceException; for Lazy Loading config.

    I could use some help configuring my persistence.xml file, trying to make sure Lazy loading is configured properly. What I see in the logs normally is that Toplink defaults to Eager fetching on my JPA objects. So according to
    http://www.oracle.com/technology/products/ias/toplink/JPA/essentials/toplink-jpa-extensions.html
    I need to set toplink.weaving=true in persistence.xml, however I get the Exception below when I make the call to get the EntityManager for the first time.
    I'm using OC4J standalone 10.1.3.3 with JDK 1.5.0_13 and the latest Toplink (as you can see in the stack trace below). An excerpt from my persistence.xml is below that.
    Caused by: Exception [TOPLINK-30005] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
    Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: xyx-dal-webservice.root:0.0.0
    Internal Exception: javax.persistence.PersistenceException: Exception [TOPLINK-28020] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exc
    eptions.EntityManagerSetupException
    Exception Description: Value [true] for the property [toplink.weaving] is incorrect when global instrumentation is null, value should either be null or false. at oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:143)
    at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:169)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:59)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
    at gov.dhs.visit.ident.dal.jpa.entity.cvt.util.EntityManagerHelper.<clinit>(EntityManagerHelper.java:20)
    ... 43 more
    Caused by: javax.persistence.PersistenceException: Exception [TOPLINK-28020] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.E
    ntityManagerSetupException
    Exception Description: Value [true] for the property [toplink.weaving] is incorrect when global instrumentation is null, value should either be null or false.
    at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.callPredeploy(JavaSECMPInitializer.java:151)
    at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initPersistenceUnits(JavaSECMPInitializer.java:239)
    at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initialize(JavaSECMPInitializer.java:255)
    at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:155)
    ... 46 more
    Caused by: Exception [TOPLINK-28020] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
    Exception Description: Value [true] for the property [toplink.weaving] is incorrect when global instrumentation is null, value should either be null or false.
    at oracle.toplink.essentials.exceptions.EntityManagerSetupException.wrongWeavingPropertyValue(EntityManagerSetupException.java:244)
    ... 50 more
    SEVERE: Caught exception while handling request: oracle.oc4j.rmi.OracleRemoteException: java.lang.ExceptionInInitializerError; nested exception is:
    java.lang.ExceptionInInitializerError oracle.oc4j.rmi.OracleRemoteException: java.lang.ExceptionInInitializerError; nested exception is:
    java.lang.ExceptionInInitializerError
    persistence.xml
      <persistence-unit name="PUName" transaction-type="JTA">
         <provider>oracle.toplink.essentials.PersistenceProvider</provider>
              <jta-data-source>jdbc/mydb</jta-data-source>
    <class>....a whole lotta JPA classes...</class>
        <properties>
             <property name="toplink.logging.level" value="FINE" />
             <property name="toplink.logging.timestamp" value="true"/>
               <property name="toplink.target-database" value="Oracle"/>
               <property name="toplink.target-server" value="OC4J_10_1_3" />
               <property name="toplink.weaving" value="true"/>
                    <property name="toplink.cache.shared.default" value="false"/>
        </properties>
      </persistence-unit>

    This error confuses me...
    Exception [TOPLINK-30005] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
    Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@11b86e7
    Internal Exception: javax.persistence.PersistenceException: Exception [TOPLINK-28020] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
    Exception Description: Value [true] for the property [toplink.weaving] is incorrect when global instrumentation is null, value should either be null or false.
         at oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:143)
         at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:169)
         at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:110)I'm using TopLink from regular ol' Java SE (not container managed environment).
    http://www.oracle.com/technology/products/ias/toplink/JPA/essentials/toplink-jpa-extensions.html gives some hints, though, especially if you're operating outside of a container (seems like you gotta weave yourself). See http://www.oracle.com/technology/products/ias/toplink/JPA/essentials/toplink-jpa-extensions.html#LazyLoading
    Seems the command-line arg "-javaagent:toplink-essentials-agent.jar" is critical if you're running outside a container.

  • Hibernate lazy loading with spring

    Has anyone been able to successfully implement the org.springframework.orm.hibernate3.support.PortletOpenSessionInViewInterceptor to enable hibernate lazy loading with page flows? Any examples would be helpful.
    Thanks

    Don't double post. I've removed the thread you started 3 hrs 16 minutes after this one with the identically same question.
    db

  • Facing problem with lazy loading in ejb3.0

    The following error is coming up when i try to access the collection in the entity entity bean. i am using entitymanager.find() to retrieve the entity. intial set of values are coming fine but when try to access the collection in the entity the error is coming up. one solution is to make the fetch type=eager. but can we do lazy loading with out any problem. the following is the error. kindly help me in this. do i need to do anything extra that mean have to add any annotations or anything.
    org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.lucid.erp.entities.EmployeeDTO.addresses, no session or session was closed
         at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
         at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
         at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
         at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
         at org.hibernate.collection.PersistentBag.get(PersistentBag.java:422)
         at com.lucidlabs.erp.actions.EmployeeAction.view(EmployeeAction.java:20)
         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 com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404)
         at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267)
         at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
         at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
         at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
         at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
         at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
         at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
         at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
         at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:184)
         at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
         at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)
         at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)
         at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)
         at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)
         at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         at

    this is transactions 101 material. Do you know about transactions and how they work? Do you know about managed entities?
    The problem you are having is that the addresses are accessed outside of the transaction in which the entity was fetched. That means there is no more database session and thus the lazy fetch cannot work. If you really need the addresses, you can at least force fetch them by calling getAddresses().size() right after you fetch the entity from the database; assuming that the transaction is still active at that point.

  • ConcurrentModificationException - concurrent requests while lazy loading a relationship without server warmup

    Hello,
    We are running into a ConcurrentModificationException when we are firing 100 concurrent requests without warming up the server.
    Looks like the error is coming up when a a relationship is  being lazy loaded.
    We are seeing this behavior consistently. Once the server is warmed up, we are not seeing any issues under concurrency.
    I am attaching the two DAOs that are related to the issue.
    ExtensionPointRulesetDAO has a M:1 relationship with RuleSetEntityDAO and we are getting the error when ExtensionPointRuleSetDAO._persistence_get_ruleSetEntity() is called.
    2015-02-13 12:14:24,021 ERROR [uimadmin] [[ACTIVE] ExecuteThread: '11' for queue: 'weblogic.kernel.Default (self-tuning)'] [ExtensionRuleMediator] [INV-180012] Failed to retrieve the extension point ruleset: null.
    java.util.ConcurrentModificationException
        at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:859)
        at java.util.ArrayList$Itr.next(ArrayList.java:831)
        at org.eclipse.persistence.internal.databaseaccess.ParameterizedSQLBatchWritingMechanism.executeBatchedStatements(ParameterizedSQLBatchWritingMechanism.java:134)
        at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:574)
        at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:535)
        at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:1717)
        at org.eclipse.persistence.sessions.server.ClientSession.executeCall(ClientSession.java:253)
        at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:207)
        at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:193)
        at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectOneRow(DatasourceCallQueryMechanism.java:666)
        at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectOneRowFromTable(ExpressionQueryMechanism.java:2656)
        at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectOneRow(ExpressionQueryMechanism.java:2627)
        at org.eclipse.persistence.queries.ReadObjectQuery.executeObjectLevelReadQuery(ReadObjectQuery.java:450)
        at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1081)
        at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:844)
        at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1040)
        at org.eclipse.persistence.queries.ReadObjectQuery.execute(ReadObjectQuery.java:418)
        at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1128)
        at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2871)
        at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1516)
        at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1498)
        at org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:98)
        at org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiateForUnitOfWorkValueHolder(QueryBasedValueHolder.java:113)
        at org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiateImpl(UnitOfWorkValueHolder.java:156)
        at org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiate(UnitOfWorkValueHolder.java:222)
        at org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:88)
        at oracle.communications.platform.entity.impl.ExtensionPointRuleSetDAO._persistence_get_ruleSetEntity(ExtensionPointRuleSetDAO.java)
        at oracle.communications.platform.entity.impl.ExtensionPointRuleSetDAO.getRuleSetEntity(ExtensionPointRuleSetDAO.java:272)
        at oracle.communications.inventory.extensibility.extension.util.ExtensionRuleMediator.findExtensionPointRule(ExtensionRuleMediator.java:267)
        at oracle.communications.inventory.extensibility.extension.util.ExtensionRuleMediator.initialize(ExtensionRuleMediator.java:134)
        at oracle.communications.inventory.extensibility.extension.SpecBasedArgumentExtension.configureMediator(SpecBasedArgumentExtension.aj:134)
    Thanks,
    Ravindra

    Hi,
    Found a note explaining the significance of these errors.
    It says:
    "NZE-28862: SSL connection failed
    Cause: This error occurred because the peer closed the connection.
    Action: Enable Oracle Net tracing on both sides and examine the trace output. Contact Oracle Customer support with the trace output."
    For further details you may refer the Note: 244527.1 - Explanation of "SSL call to NZ function nzos_Handshake failed" error codes
    Thanks & Regards,
    Sindhiya V.

  • Lazy loading loads eager anyway ?

    Hello,
    I read in some articles and books that the lazy loading in EJB 3.0 is just a hint, in the sence that the persistence manager could decide to load eager, even if lazy configured.
    Is this correct, or will the default lazy loading always only fetch when asked ?
    C.

    This is true in the JPA Spec, i.e. meaning that supporting lazy loading is "optional" not required by the JPA Spec.
    However TopLink does support lazy loading. By default any @OneToMany or @ManyToMany mappings are lazy and will not be fetched until accessed. By default in the JPA Spec @OneToOne and @ManyToOne are not lazy, but if you set them to be lazy then TopLink will also support this, as long as you enable weaving (weaving is not require for @ToManys). I would recommend you always make your @OneToOne and @ManyToOne lazy. Weaving in TopLink can be enable either through using the TopLink agent when launching your Java VM, or is used automatically in OracleAS or Glassfish, or through using the TopLink static weaving ant task.
    In TopLink Essentials lazy on @Basic mappings is not supported, however this will be supported in TopLink 11g.

  • Lazy loading in blazeds

    Hi ,
    Can anyone tell me how to have support for lazy loading with blazeds.I am not using hibernate etc on server side only jboss and ejbs to acess DB.

    Hi Maitrey,
    dpHibernate is an external project, that solves this common problem.
    http://code.google.com/p/dphibernate/
    Best regards,
    Sd.Plox

  • It seems you cannot clone objects with attributes using lazy loading in JPA

    I have an entity with an attribute using lazy loading:
    @Entity
    public class B {
    @ManyToOne(fetch=FetchType.LAZY)
    private A a;
    @Entity
    public class A {
    Assume the following code:
    A a1 = new A();
    A a2 = new A();
    B b1 = EntityManager.find(B.class, ...);
    b1.setA(a1);
    B b2 = b1.clone();
    b2.setA(a2);
    Now with lazy loading enabled I get b1.getA() == a2 instead of b1.getA() == a1. Moreover, the debugger displays the same value holder in b1 and b2 for the attribute a. It appears as if cloning does not make a (deep) copy of the value holder managing the attribute a.
    How can I create a copy b2 of b1, such that the value holder managing a in b1 is a different object as the value holder managing a in b2?
    Thanks, Thomas.

    I have filed a bug to have this addressed in Oracle TopLink 11gR1. I would recommend you file a bug against TopLink Essentials in GlassFish or if you have a support contract report the issue to metalink to have the issue resolved.
    If this is urgent I did try fixing the issue with a small helper method using some reflection. This method is simplified through its throwing of Exception. If you wish to use something like this I would recommend proper error handling.
         * Helper method for cloning an entity and fixing the woven value-holders to
         * complete a proper shallow cloning.
        public static Employee clone(Employee entity) throws Exception {
           Employee clone = entity.clone();
           // Now fix the cloned ValueHolder references
           Field[] fields = entity.getClass().getDeclaredFields();
           for (int index = 0; index < fields.length; index++) {
               Field field = fields[index];
               if (field.getName().startsWith("_toplink_")) {
                   field.setAccessible(true);
                   ValueHolderInterface vhi = (ValueHolderInterface)field.get(entity);
                   Object value = vhi.isInstantiated() ? vhi.getValue() : null;
                   field.set(clone, new ValueHolder(value));
           return clone;
        }Doug

  • Lazy load easy implementation?

    I'm trying to add lazy loading to a page I created in muse so that when someone views the page on their phone it does not load all 170mb worth of images that are on the page unless the user scrolls down through the entire page- is there an easy way to implement lazy load in Muse? I'm not very good with html and have 0 query experience so any details on how to implement this would be infinitely appreciated
    Thanks!

    This should work if using TopLink/EclipseLink.

  • Lazy loading, EntityManager and concurrency.

    I need advice which strategy to use with lazy loading.
    My project is based on Spring, Struts 2 and Hibernate JPA. I have enough OneToMany and ManyToMany relationships and it's reasonable to use lazy loading. It seems very convenient to load data in Struts Actions with OpenEntityManagerInViewFilter in such way like:
    Style style = user.getStyle()
    But to avoid LazyLoadException I have to use:
    @PersistenceContext(type=PersistenceContextType.EXTENDED)
    Unfortunately, EntityManager in this case becomes not thread-safe, according to Spring docs: "+Extended EntityManagers are not thread-safe, hence they must not be used in concurrently accessed beans (which Spring-managed singletons usually are).+" EXTENDED means that EntityManager is shared in user session and my EntityManager is injected in singleton services.
    I've found this issue when tried to make quick sequential page reloading which call some selects and got:
    java.sql.SQLException: You can't operate on a closed Statement!!!
    What's the best practice in this situation:
    1. Try synchronize session access to EntityManager by myself or put each user database requests in separate queue (something terrible I suppose).
    2. Use HQL queries with join fetch to preload data for access outside of transaction (maybe overhead).
    3. Or something else???
    And why we need EXTENDED context if it's so unreliable??
    Thanks for help!

    Hi
    Do you have the link to the "lazy loading content"?
    I can't find a proper way to do it.
    Thanks

  • JPA: Toplink vs Hibernate

    I am using netbeans 5.5 and I want to use JPA. I am in favor of hibernate, but why does the netbeans has toplink being the default persistence library of JPA? What are the difference between toplink and hibernate if I'll be using JPA?
    By the way, I've seen an article "Using JPA in tomcat" and I would really like to use JPA in tomcat as I think it is much faster and lighter than Glassfish. But the article also uses toplink as the persistence library? Could someone guide me in using hibernate?

    This is an video from NetBeans site. Take a look.
    It will open your eyes about Hibernate and TopLink and JPA after you checking the codes that will be generated on your own system application.
    http://www.netbeans.org/download/flash/netbeans_6_gui_builder/netbeans_6_gui_builder.html

  • Toplink vs hibernate

    hi
    who can i determine which technology is better to use with oracle. Toplink or hybernate
    mostly we use hybernate but I want to know why toplink is better than hybernate
    thanks
    Message was edited by:
    Doug Clarke

    One of the key differences between TopLink and Hibernate is the caching implementation. TopLink provides an object cache where instances can be shared across the application, client, or transaction controlled by mapping metadata and application usage. The benefits of the shared cache are clear where read-only and read-mostly objects can be shared to avoid creating many copies of the objects unnecessarily (performance costs and extra garbage creation).
    If you have more volatile or data types that are not shared you can configure TopLink's caching to be isolated and therefore only cache the objects per client or transaction.
    If you have use cases where you need to ensure you get a transactionally isolated instance of an object you have configured to be held in the shared cache you can access the object within a UnitOfWork. This will make a read-repeatable copy of the object within the 'transaction' that will not be changed by concurrent writes from other committing UnitOfWork.
    Ultimately we work hard to offer TopLink/EclipseLink developers a solution with configurable and flexible options to address a wide variety of requirements. Understanding and leveraging our cache is a key success factor in any application development with TopLink.
    As far as the duplicate SQL comment goes I have reviewed the support request we recently received on this and the issue appears to be that if you change the existence-checking from its default of check-cache to check-database we have a bug where we incorrectly check the database for each registered new instance with a zero PK value. When we see an object with a zero primary key and sequencing configured it should be assumed to be new without requiring the select. We are working with support to get this issue addressed.
    Doug

  • Lazy loading or indirection for direct to field mapping striing object

    Hi,
    I need to achieve indirection for String instance variable, currently mapped using direct to field mapping.
    This field is a text column in sql server storing large data which is rarely read.
    Recently we have been noticing that it is causing lot of IO on our SAN system.
    Is there a way indirection can be achieved for this which is currently mapped as direct to field.
    I have tried using indirection in transformation mapping. But profiling db indicates above mentioned text column is still part of the select query.
    Thanks
    Nagesh

    Hi Nagesh,
    There is no support for lazy loading of DirectToField mappings in TopLink 10.1.3 POJO persistence. Typically, people who have large CLOBs or BLOBs will put them in a separate table to avoid loading them with their owner. If you can't refactor your data model to accomodate this things get more complicated. Do you ever update these large structures are they read only in your application? If they are read only then a very simple approach is to not map the large data column and instead lazily load the data with a report query.
    Ideally you would upgrade to TopLink JPA in 11g where lazy loading of Basic mappings is supported. :-)
    --Shaun                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • ISight with AIM??

    I looked but couldnt find any topics about this. I am trying to connect isight with aim and it will not recognize isight.. anyone know how i can fix this??? thanks

  • How to remove trailing space at the end of a song.

    This is related to this thread: Shorten song length (remove trailing bars) in Garageband 10.0.1 I have also done some Googling and have found some links related to selecting and exporting regions, which I have tried, but this is what I noticed. It do

  • Retrieved forms are missing information

    I've been getting a number of complaints from applicants who have said that when they retrieve their form, information that had been previously saved is now missing. I am sure one is user error (they didn't save), but 3 others I trust definitely save

  • Alternative to MDS

    Hi all, Anyone knows an alternative to MDS in ADF? Any Idea?

  • [SOLVED] What is the best way to load iptables/nftables on boot?

    Hi - New arch user migrating from Ubuntu/debian.  I'm used to loading netfilter iptable rules using an /etc/network/interfaces file.  What is the best way to do this using netctl/systemd? An RTFM of the wiki and a Google search didn't provide an answ