Quantcast
Channel: Spring Community Forums - Data
Viewing all articles
Browse latest Browse all 297

What happen in SimpleLoadTimeWeaver class?(Spring + EclipseLink)

$
0
0
I encounter a problem, the problem had happend by annother person, i don't understand what reason result in exception. If i rewrite SimpleLoadTimeWeaver, problem will resolved.

excep
Code:

[EL Config]: 2011-06-09 00:15:24.061--ServerSession(2050312009)--Connection(473155160)--Thread(Thread[main,5,main])--Connected: jdbc:derby://localhost:1527/springhib;create=true User: app Database: Apache Derby Version: 10.6.2.1 - (999685) Driver: Apache Derby Network Client JDBC Driver Version: 10.7.1.1 - (1040133) [EL Severe]: 2011-06-09 00:15:24.127--ServerSession(2050312009)--Thread(Thread[main,5,main])--Local Exception Stack: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.IntegrityException Descriptor Exceptions:

Exception [EclipseLink-148] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.DescriptorException Exception Description: The container policy [CollectionContainerPolicy(class org.eclipse.persistence.indirection.IndirectSet)] is not compatible with transparent indirection. Mapping: org.eclipse.persistence.mappings.ManyToManyMapping[comments] Descriptor: RelationalDescriptor(pl.adaknet.hibspring.domain.ArtEntity --> [DatabaseTable(ARTENTITY)])

Code:


<import resource="data-source.xml" />

<tx:annotation-driven mode="proxy"
    transaction-manager="transactionManager" />

<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
    p:entityManagerFactory-ref="entityManagerFactory" />

<!-- Entity manager -->
<bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="persistenceUnitName" value="unit1" />
    <property name="loadTimeWeaver">
        <bean class="org.springframework.instrument.classloading.SimpleLoadTimeWeaver"/>
    </property>
    <property name="jpaVendorAdapter">
        <bean
            class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
            <property name="databasePlatform" value="org.eclipse.persistence.platform.database.DerbyPlatform" />
            <property name="showSql" value="true" />
            <property name="generateDdl" value="true" />
        </bean>
        <!-- <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> -->
        <!-- <property name="databasePlatform" value="org.hibernate.dialect.DerbyDialect"
            /> -->
        <!-- <property name="showSql" value="true" /> -->
        <!-- <property name="generateDdl" value="true" /> -->
        <!-- </bean> -->
    </property>
</bean>

<bean id="jpaTemplate" class="org.springframework.orm.jpa.JpaTemplate">
    <property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>

new Weave class:
Code:

package net.palesz.util;

import org.springframework.instrument.classloading.SimpleLoadTimeWeaver;

public class JpaAwareLoadTimeWeaver extends SimpleLoadTimeWeaver {
    @Override
    public ClassLoader getInstrumentableClassLoader() {
        ClassLoader instrumentableClassLoader = super.getInstrumentableClassLoader();
        if (instrumentableClassLoader.getClass().getName().endsWith("SimpleInstrumentableClassLoader")) {
            return instrumentableClassLoader.getParent();
        } else {
            return instrumentableClassLoader;
        }
    }
}


Viewing all articles
Browse latest Browse all 297

Trending Articles