Results 1 to 5 of 5

Thread: eclipseLink doesn't like transient entity manager

  1. #1
    Join Date
    Aug 2007
    Location
    Toronto
    Posts
    66

    Default eclipseLink doesn't like transient entity manager

    I am using Roo M2....set up a project and installed a jpa like so:

    install jpa -provider ECLIPSELINK -dataBase MYSQL

    then, ran "mvn test" and it seems that EclipeLink doesnt like the transient on:

    @javax.persistence.PersistenceContext
    transient javax.persistence.EntityManager Airport.entityManager;

    so, I changed them all (in xxx_Roo_Entity.aj) to public (Using a text editor)...and, EclipseLink seems to be happier. Not withstanding other errors, which I will investigate.

    Then, I restart Roo on the project and Roo, of course, changes them back to transient.
    Is there a way to force the use of a qualifier, other than "transient" on this annotation?

    thanks
    Edwin

  2. #2
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    Edwin,

    The transient field issue is known to cause problems with EclipseLink. I reported this back in February. You can vote on the ticket if you wish: https://bugs.eclipse.org/bugs/show_bug.cgi?id=264962

    -Stefan

  3. #3
    Join Date
    Aug 2007
    Location
    Toronto
    Posts
    66

    Default possible solution

    Thank you for the response.

    I have experimented and found that by putting the annotation and field definiton in the domain class allows an override. Placing :

    @javax.persistence.PersistenceContext
    public javax.persistence.EntityManager entityManager;

    in the domain class causes Roo to use this definition.

    Is this the preferred way of doing this?

    Thanks

  4. #4
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    Well, omitting the transient keyword for the EntityManager would cause this field to be serialized - something that is definitely undesirable .

    However, as luck would have it, the EclipseLink bug seems to have been addressed over night https://bugs.eclipse.org/bugs/show_bug.cgi?id=264962 . If you find the time, it would be nice if you could test it and see if it works now with the fixed version. Maybe EclipseLink releases nightly snapshots?

    -Stefan

  5. #5
    Join Date
    Aug 2007
    Location
    Toronto
    Posts
    66

    Default

    thanks again....I'll have a look at it at some point.....it's funny that it calls it "mapping" metadata

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •