Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] OneToOne Mapping works with FetchType.EAGER but not with FetchType.LAZY -> Exception when deploying (SGES 2.1)

I tried reproducing the issue but couldn't. I was able to use a simple test application using OneToOne lazy relationship with GlassFish V2.1 and EclipseLink 1.0.2 without any issues.

Do you see anything in your server.log before this exception that my give a clue on what might be going wrong. It might also help to turn up EclipseLink logging to FINEST and see for any issues around weaving.

Thanks,
Mitesh

zebhed wrote:
I´ve just switched from "SJSAS 9.1 update 2" (gf v2) to "SGES 2.1" (gf v2.1).
My application uses JPA and EclipseLink 1.0.2. It deploys fine on "SJSAS 9.1
update 2", but not on "SGES 2.1". I have not made any changes to the code.
When I try to deploy on "SGES 2.1", I get the following exception for every
lazy loading OneToOne mapping (fetch = FetchType.LAZY):

-----

Exception [EclipseLink-60] (Eclipse Persistence Services - 1.0.2 (Build
20081024)): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The method [_persistence_setuserProfile_vh] or
[_persistence_getuserProfile_vh] is not defined in the object
[com.war.bus.data.entity.User].
Internal Exception: java.lang.NoSuchMethodException:
com.war.bus.data.entity.User._persistence_getuserProfile_vh()
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[userProfile]
Descriptor: RelationalDescriptor(com.war.bus.data.entity.User -->
[DatabaseTable(users)])

Local Exception Stack: Exception [EclipseLink-60] (Eclipse Persistence Services - 1.0.2 (Build
20081024)): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The method [_persistence_setuserProfile_vh] or
[_persistence_getuserProfile_vh] is not defined in the object
[com.war.bus.data.entity.User].
Internal Exception: java.lang.NoSuchMethodException:
com.war.bus.data.entity.User._persistence_getuserProfile_vh()
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[userProfile]
Descriptor: RelationalDescriptor(com.war.bus.data.entity.User -->
[DatabaseTable(users)])
	at
org.eclipse.persistence.exceptions.DescriptorException.noSuchMethodWhileInitializingAttributesInMethodAccessor(DescriptorException.java:1139)
	at
org.eclipse.persistence.internal.descriptors.MethodAttributeAccessor.initializeAttributes(MethodAttributeAccessor.java:151)
	at
org.eclipse.persistence.mappings.DatabaseMapping.preInitialize(DatabaseMapping.java:1061)
	at
org.eclipse.persistence.mappings.ForeignReferenceMapping.preInitialize(ForeignReferenceMapping.java:724)
	at
org.eclipse.persistence.mappings.ObjectReferenceMapping.preInitialize(ObjectReferenceMapping.java:818)
	at
org.eclipse.persistence.descriptors.ClassDescriptor.preInitialize(ClassDescriptor.java:2903)
	at
org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:416)
	at
org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:396)
	at
org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:641)
	at
org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:594)
	at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:209)
	at
org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:246)
	at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:69)
	at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:118)
	at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:112)
	at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:100)
	at
com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.loadPersistenceUnitBundle(PersistenceProcessor.java:573)
	at
com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.createTablesInDB(PersistenceProcessor.java:421)
	at
com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.processAppBundle(PersistenceProcessor.java:287)
	at
com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.processApplication(PersistenceProcessor.java:189)
	at
com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processApplication(DeploymentEventListenerImpl.java:211)
	at
com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processEvent(DeploymentEventListenerImpl.java:172)
	at
com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.notifyDeploymentEvent(DeploymentEventListenerImpl.java:122)
	at
com.sun.enterprise.deployment.backend.DeploymentEventManager.notifyDeploymentEvent(DeploymentEventManager.java:79)
	at
com.sun.enterprise.deployment.backend.AppDeployer.postDeploy(AppDeployer.java:401)
	at
com.sun.enterprise.deployment.backend.AppDeployer.deploy(AppDeployer.java:260)
	at
com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.java:148)
	at
com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:208)
	at
com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:108)
	at
com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:966)
	at
com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:283)
	at
com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:835)
	at
com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:187)
	at
com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:225)
Caused by: java.lang.NoSuchMethodException:
com.war.bus.data.entity.User._persistence_getuserProfile_vh()
	at java.lang.Class.getDeclaredMethod(Class.java:1937)
	at
org.eclipse.persistence.internal.security.PrivilegedAccessHelper.findMethod(PrivilegedAccessHelper.java:59)
	at
org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getMethod(PrivilegedAccessHelper.java:226)
	at
org.eclipse.persistence.internal.helper.Helper.getDeclaredMethod(Helper.java:892)
	at
org.eclipse.persistence.internal.descriptors.MethodAttributeAccessor.initializeAttributes(MethodAttributeAccessor.java:144)
	... 32 more

------

If I change the OneToOne mapping to load eagerly (fetch = FetchType.EAGER),
the exception doesn´t occur. I know that GF/Toplink Essentials once had a
similar bug (https://glassfish.dev.java.net/issues/show_bug.cgi?id=3295).

QUESTION: What could be the cause for this exception? Is it a bug? Do I have
to switch back to SJSAS 9.1?

------

This is my persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
persistence_1_0.xsd">
    <persistence-unit name="war-ejbPU" transaction-type="JTA">
	<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
	<jta-data-source>jdbc/WarConnectionPool</jta-data-source>
	<properties>
	    <property name="eclipselink.target-server" value="SunAS9"/><!--//maybe
not needed if using GF v2.1 -->
	    <property name="eclipselink.ddl-generation" value="create-tables"/>
	    <property name="eclipselink.ddl-generation.output-mode"
value="database"/>
	    <property name="eclipselink.logging.level" value="info"/>
	</properties>
    </persistence-unit>
</persistence>


Back to the top