[2.4] JPA annotations problem

198 views
Skip to first unread message

Myrosia Dzikovska

unread,
Jul 6, 2015, 11:50:18 AM7/6/15
to play-fr...@googlegroups.com
We are using Ebean + JPA annotations in 2.3. I am now upgrading to 2.4, and I am getting confusing compile errors.

My class is
package models;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MapsId;
import javax.persistence.Table;
import com.avaje.ebean.Model;

@Entity
@Table(name="reading")
public class Reading extends Model {

   
@EmbeddedId
   
public ReadingPK key;
       
   
@MapsId("id")
   
@JoinColumn(name="sensorid")
   
@ManyToOne
   
public Sensor sensor;
....
}


The compiler is complaining that it cannot find a "MapsId" class:


[error] /afs/inf.ed.ac.uk/user/m/mdzikovs/research/ideal/software/gui/play-upgrade-branch/app/models/Reading.java:9: cannot find symbol
[error]   symbol:   class MapsId
[error]   location: package javax.persistence


I tried Google, but with no success, and given that this worked in 2.3, I don't even know where to begin looking at the problem. Is there some way to get extra debug information out of SBT? Or has there been some change in JPA api that i am not aware of?

Thanks

Myrosia

Myrosia Dzikovska

unread,
Jul 6, 2015, 12:26:16 PM7/6/15
to play-fr...@googlegroups.com
The compiler is complaining that it cannot find a "MapsId" class:


[error] /afs/inf.ed.ac.uk/user/m/mdzikovs/research/ideal/software/gui/play-upgrade-branch/app/models/Reading.java:9: cannot find symbol
[error]   symbol:   class MapsId
[error]   location: package javax.persistence


I tried Google, but with no success, and given that this worked in 2.3, I don't even know where to begin looking at the problem. Is there some way to get extra debug information out of SBT? Or has there been some change in JPA api that i am not aware of?

Thanks

Myrosia

Ah, I see what's going on now, at least partially. In the old (2.3) compile the output of 'activator "export compile:dependencyClasspath"' contains ".ivy2/cache/org.hibernate.javax.persistence/hibernate-jpa-2.0-api/jars/hibernate-jpa-2.0-api-1.0.1.Final.jar" while in 3.4 I see "/.ivy2/cache/javax.persistence/persistence-api/jars/persistence-api-1.0.jar". "MapsId" is part of JPA 2.0.

We weren't using hibernate in 2.3 in any way, but I am guessing it was being pulled in as part of the defaults. And the new standalone ebean plugin doesn't seem to be bringing in the JPA 2.0 dependency.

Not sure how to fix it, though - guess I will try adding hibernate as an extra dependency, and see what happens.

Myrosia
Reply all
Reply to author
Forward
0 new messages