Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: AW: AW: [eclipselink-users] @ElementCollection with @Embeddables and weaving

Hi Rafal,

  This issue appears to be solved in EclipseLink 2.0.1.

-Tom

Swierzynski, Rafal wrote:
Hi Tom,

please see the full (FINEST) logging output attached in log.txt.
root.trace.txt is the stack trace that I got by putting the breakpoint in the line that does the throw new RollbackException(ex); (EntityTransactionImpl;182) and evaluated ex with a watch expression.
Is this the information you requested?

Regards,
Rafał
________________________________________
Von: eclipselink-users-bounces@xxxxxxxxxxx [eclipselink-users-bounces@xxxxxxxxxxx] im Auftrag von Tom Ware [tom.ware@xxxxxxxxxx]
Gesendet: Freitag, 12. März 2010 22:06
An: EclipseLink User Discussions
Betreff: Re: AW: [eclipselink-users] @ElementCollection with @Embeddables       and weaving

Hi Rafal,

   Can you run the code with LOGGING turned on?  What does the logging look like?

   Also, is it possible to get a full stack trace that includes the cause - the
line of code referenced in the stack trace does this:

             throw new RollbackException(ex);

   "ex" should be made the cause and it would be quite useful to see what ex and
its stack are.

-Tom


Swierzynski, Rafal wrote:
Hi Tom,
I think the most important difference is that this time I don't clear() the entity manager. You also need to enable weaving to get this exception, but this is probably not relevant to why I can go past the find(). The other code called clear() and hence EL had to fully load the entity from the database, whereas this time it is in the persistence context (it is application managed and hence extended). This time it fails when it tries to calculate the changes at commit / flush time.
This issue with weaving is the original problem I wanted to post. The other one, with the collection mapping and key types incompatibility, just popped up as I was creating the simplest possible test case for this issue to post on this list so that it is easy for readers to reproduce and maybe give hints. I gathered I was doing something wrong there and so I wanted to ask what is wrong.

Regards,
Rafał
________________________________________
Von: eclipselink-users-bounces@xxxxxxxxxxx [eclipselink-users-bounces@xxxxxxxxxxx] im Auftrag von Tom Ware [tom.ware@xxxxxxxxxx]
Gesendet: Freitag, 12. März 2010 16:42
An: EclipseLink User Discussions
Betreff: Re: [eclipselink-users] @ElementCollection with @Embeddables and       weaving

Hi Rafal,

   You posted an issue with a similar object model earlier that indicates that
the "find" does not work.  How is this scenario different - how are you getting
past the find?

-Tom

Swierzynski, Rafal wrote:
Hi,

I use the EclipseLink javaagent for weaving. My entity class looks like the following:

@Entity
public class SomeEntity {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue
    private Long id;

    @ElementCollection(fetch = FetchType.EAGER)
    @CollectionTable(name = "SomeMap")
    private Set<Pair> someSet = new HashSet<Pair>();

    public Long getId() {
        return id;
    }

    public void put(String key, String value) {
        someSet.add(new Pair(key, value));
    }
}

In the logs, I noticed this line:

[EL Config]: 2010-03-12 14:49:38.828--ServerSession(5506056)--Class com.test.SomeEntity could not be weaved for change tracking as it is not supported by its mappings.

This is probably by the collection of embeddables. Now, it is a config information so I ignored it and wanted to proceed. The code I invoke is the following:

EntityManagerFactory emf = Persistence.createEntityManagerFactory("TestJPA");
EntityManager em = emf.createEntityManager();
EntityTransaction tx = em.getTransaction();
tx.begin();
SomeEntity s = new SomeEntity();
s.put("en", "table");
s.put("de", "Tish");
s.put("pl", "stół");
em.persist(s);
tx.commit();

tx.begin();
s = em.find(SomeEntity.class, s.getId());
tx.commit();

When the second commit is invoked, the following exception is thrown:

[EL Warning]: 2010-03-12 14:49:39.531--UnitOfWork(27742346)--java.lang.NullPointerException
Exception in thread "main" javax.persistence.RollbackException: java.lang.NullPointerException
      at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:102)
      at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:63)
      at com.test.Start.main(Start.java:26)
Caused by: java.lang.NullPointerException
      at org.eclipse.persistence.descriptors.changetracking.AttributeChangeTrackingPolicy.createObjectChangeSet(AttributeChangeTrackingPolicy.java:57)
      at org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetectionPolicy.calculateChanges(DeferredChangeDetectionPolicy.java:89)
      at org.eclipse.persistence.internal.descriptors.ObjectBuilder.compareForChange(ObjectBuilder.java:1574)
      at org.eclipse.persistence.mappings.AggregateCollectionMapping.compareForChange(AggregateCollectionMapping.java:495)
      at org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetectionPolicy.createObjectChangeSetThroughComparison(DeferredChangeDetectionPolicy.java:159)
      at org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetectionPolicy.createObjectChangeSet(DeferredChangeDetectionPolicy.java:136)
      at org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetectionPolicy.calculateChanges(DeferredChangeDetectionPolicy.java:89)
      at org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetectionPolicy.calculateChangesForExistingObject(DeferredChangeDetectionPolicy.java:54)
      at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.calculateChanges(UnitOfWorkImpl.java:624)
      at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1495)
      at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java:200)
      at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitAndResume(UnitOfWorkImpl.java:1131)
      at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:84)
      ... 2 more


I have exactly the same problem for Map collection when the value is an embeddable. This seems somehow interconnected to the weaving warning I got earlier. The problem goes away when weaving is not used, but it exists when I deploy to GlassFish v3. Is this a bug?

I attach the full source code to the mail. Please remember to enable weaving.

Regards,
Rafał


------------------------------------------------------------------------

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


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



------------------------------------------------------------------------

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


Back to the top