[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Inheritance Question

Hi Alex,

I think there is a bug here. Please feel free to file one. I simply wanted to assess whether you were able to proceed with the current level of support.

I recommend enabling internal weaving unless you see some problem as a result of it. It enables several performance optimizations and it is rare that we see problems with it.

-Tom

On 10/04/2012 2:02 AM, Alexander Mischur wrote:
Hi Tom,

thanks for the reply.
I don't need the self generated serialversion id. I faced the problem and
figured out the 2 solutions.
I'm asking because I'm interested.

Would you recommend to enable internal weaving always?

-Alex


On Mon, Apr 9, 2012 at 2:52 PM, Tom Ware <tom.ware@xxxxxxxxxx <mailto:tom.ware@xxxxxxxxxx>> wrote:

    Our internal weaving is generating a serialversionid.  I suspect there is
    some conflict.  Is there any reason you need to be the one that generates
    the serialversion id?

    -Tom


On 08/04/2012 11:38 AM, Alexander Mischur wrote:

        Hi all,

        I’m using eclipselink 2.3.2 and jpa 2.0.3 and jdk 7u3

        I have the following 3 classes:

        @Entity
        @Table(name = "book")
        @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
        @DiscriminatorColumn(name = "clazz", discriminatorType =
        DiscriminatorType.STRING)
        public abstract class Book implements Serializable {

             /**
              *
              */
             private static final long serialVersionUID = 6958823087646370497L;

             @Id
             @GeneratedValue(strategy = GenerationType.TABLE)
             @Column(name = "id")
             private Long id;

             @Column(name = "title")
             private String title;

             @Column(name = "ISBN")
             private String isbn;

             @Column(name = "author")
             private String author;
        }

        @Entity(name = "PaperBook")
        @DiscriminatorValue(value = "PaperBook")
        public class PaperBook extends Book {

             @Column(name = "pages")
             private Integer pages;
        }

        @Entity(name = "AudioBook")
        @DiscriminatorValue(value = "AudioBook")
        public class AudioBook extends Book {

             @Column(name = "medium")
             private String medium;

             @Column(name = "length_in_minutes")
             private Integer lengthInMinutes;
        }
        My persistence.xml looks like this:
        <persistence xmlns="http://java.sun.com/__xml/ns/persistence
        <http://java.sun.com/xml/ns/persistence>"
                      xmlns:xsi="http://www.w3.org/__2001/XMLSchema-instance
        <http://www.w3.org/2001/XMLSchema-instance>"

          xsi:schemaLocation="http://__java.sun.com/xml/ns/__persistence
        <http://java.sun.com/xml/ns/persistence>
        http://java.sun.com/xml/ns/__persistence/persistence_2_0.__xsd
        <http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd>">

        <persistence-unit name="libraryPU" transaction-type="RESOURCE___LOCAL">
        <provider>org.eclipse.__persistence.jpa.__PersistenceProvider</provider>
        <class>de.mischur.library.__entities.Book</class>
        <class>de.mischur.library.__entities.PaperBook</class>
        <class>de.mischur.library.__entities.AudioBook</class>
        </persistence-unit>

        </persistence>

        When I generate a serialVersionUID for one of the 3 classes and then
        execute a
        select via persistenceManager I get this exception:

        java.lang.AbstractMethodError:
        de.mischur.library.entities.__PaperBook._persistence___shallow_clone()Ljava/lang/__Object;
        at
        org.eclipse.persistence.__descriptors.copying.__PersistenceEntityCopyPolicy.__buildClone(__PersistenceEntityCopyPolicy.__java:35)
        at
        org.eclipse.persistence.__internal.descriptors.__ObjectBuilder.__buildBackupClone(__ObjectBuilder.java:480)
        at
        org.eclipse.persistence.__descriptors.changetracking.__DeferredChangeDetectionPolicy.__buildBackupClone(__DeferredChangeDetectionPolicy.__java:218)
        at
        org.eclipse.persistence.__internal.descriptors.__ObjectBuilder.__buildWorkingCopyCloneFromRow(__ObjectBuilder.java:1699)
        at
        org.eclipse.persistence.__internal.descriptors.__ObjectBuilder.__buildObjectInUnitOfWork(__ObjectBuilder.java:664)
        at
        org.eclipse.persistence.__internal.descriptors.__ObjectBuilder.buildObject(__ObjectBuilder.java:601)
        at
        org.eclipse.persistence.__internal.descriptors.__ObjectBuilder.buildObject(__ObjectBuilder.java:560)
        at
        org.eclipse.persistence.__queries.ObjectLevelReadQuery.__buildObject(__ObjectLevelReadQuery.java:717)
        at
        org.eclipse.persistence.__queries.ReadAllQuery.__registerResultInUnitOfWork(__ReadAllQuery.java:769)
        at
        org.eclipse.persistence.__queries.ReadAllQuery.__executeObjectLevelReadQuery(__ReadAllQuery.java:433)
        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.ReadAllQuery.execute(__ReadAllQuery.java:392)
        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.sessions.__AbstractSession.executeQuery(__AbstractSession.java:1463)
        at
        org.eclipse.persistence.__internal.jpa.EJBQueryImpl.__executeReadQuery(EJBQueryImpl.__java:485)
        at
        org.eclipse.persistence.__internal.jpa.EJBQueryImpl.__getResultList(EJBQueryImpl.__java:742)
        at
        de.mischur.library.dao.impl.__GenericDaoImpl.findAll(__GenericDaoImpl.java:54)
        at de.mischur.library.dao.__BookDaoTest.testFindAll(__BookDaoTest.java:37)
        at sun.reflect.__NativeMethodAccessorImpl.__invoke0(Native Method)
        at
        sun.reflect.__NativeMethodAccessorImpl.__invoke(__NativeMethodAccessorImpl.java:__57)
        at
        sun.reflect.__DelegatingMethodAccessorImpl.__invoke(__DelegatingMethodAccessorImpl.__java:43)
        at java.lang.reflect.Method.__invoke(Method.java:601)
        at
        org.junit.runners.model.__FrameworkMethod$1.__runReflectiveCall(__FrameworkMethod.java:44)
        at
        org.junit.internal.runners.__model.ReflectiveCallable.run(__ReflectiveCallable.java:15)
        at
        org.junit.runners.model.__FrameworkMethod.__invokeExplosively(__FrameworkMethod.java:41)
        at
        org.junit.internal.runners.__statements.InvokeMethod.__evaluate(InvokeMethod.java:20)
        at
        org.springframework.test.__context.junit4.statements.__RunBeforeTestMethodCallbacks.__evaluate(__RunBeforeTestMethodCallbacks.__java:74)
        at
        org.springframework.test.__context.junit4.statements.__RunAfterTestMethodCallbacks.__evaluate(__RunAfterTestMethodCallbacks.__java:83)
        at
        org.springframework.test.__context.junit4.statements.__SpringRepeat.evaluate(__SpringRepeat.java:72)
        at
        org.springframework.test.__context.junit4.__SpringJUnit4ClassRunner.__runChild(__SpringJUnit4ClassRunner.java:__231)
        at
        org.junit.runners.__BlockJUnit4ClassRunner.__runChild(__BlockJUnit4ClassRunner.java:__49)
        at org.junit.runners.__ParentRunner$3.run(__ParentRunner.java:193)
        at org.junit.runners.__ParentRunner$1.schedule(__ParentRunner.java:52)
        at org.junit.runners.__ParentRunner.runChildren(__ParentRunner.java:191)
        at org.junit.runners.__ParentRunner.access$000(__ParentRunner.java:42)
        at org.junit.runners.__ParentRunner$2.evaluate(__ParentRunner.java:184)
        at
        org.springframework.test.__context.junit4.statements.__RunBeforeTestClassCallbacks.__evaluate(__RunBeforeTestClassCallbacks.__java:61)
        at
        org.springframework.test.__context.junit4.statements.__RunAfterTestClassCallbacks.__evaluate(__RunAfterTestClassCallbacks.__java:71)
        at org.junit.runners.__ParentRunner.run(ParentRunner.__java:236)
        at
        org.springframework.test.__context.junit4.__SpringJUnit4ClassRunner.run(__SpringJUnit4ClassRunner.java:__174)
        at
        org.eclipse.jdt.internal.__junit4.runner.__JUnit4TestReference.run(__JUnit4TestReference.java:50)
        at
        org.eclipse.jdt.internal.__junit.runner.TestExecution.__run(TestExecution.java:38)
        at
        org.eclipse.jdt.internal.__junit.runner.RemoteTestRunner.__runTests(RemoteTestRunner.__java:467)
        at
        org.eclipse.jdt.internal.__junit.runner.RemoteTestRunner.__runTests(RemoteTestRunner.__java:683)
        at
        org.eclipse.jdt.internal.__junit.runner.RemoteTestRunner.__run(RemoteTestRunner.java:390)
        at
        org.eclipse.jdt.internal.__junit.runner.RemoteTestRunner.__main(RemoteTestRunner.java:__197)

        When I remove the serialVersionUID or disable internal-weaving
        [eclipselink.weaving.internal=__false] then everything works fine.

        Can someone please explain what is going on in the background of
        eclipselink?
        And why is everything working when internal-weaving at runtime is disabled?

        Thank you in advance
        Regards
        Alex


_________________________________________________ eclipselink-users mailing list eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx> https://dev.eclipse.org/__mailman/listinfo/eclipselink-__users <https://dev.eclipse.org/mailman/listinfo/eclipselink-users>

    _________________________________________________
    eclipselink-users mailing list
    eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>
    https://dev.eclipse.org/__mailman/listinfo/eclipselink-__users
    <https://dev.eclipse.org/mailman/listinfo/eclipselink-users>




_______________________________________________ eclipselink-users mailing list eclipselink-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-users