Flukey
Flukey

Reputation: 6555

Play 2 JPA Oracle - Extra column 'ebean_intercept' even when ebeanEnabled is set to false in build.scala

I'm using JPA in Play 2. In my Build.scala, I have the following:

object ApplicationBuild extends Build {

  val appName = "weasel"
  val appVersion = "1.0-SNAPSHOT"

  val appDependencies = Seq(
    javaCore,
    javaJdbc,
    javaJpa,
    "org.hibernate" % "hibernate-entitymanager" % "4.1.7.Final"
  )

  val main = play.Project(appName, appVersion, appDependencies).settings(
    ebeanEnabled := false
  )
}

A very simple model:

import javax.persistence.*;
@Entity
@Table(name = "event")
public class Event {
    @Id
    @Column(name = "EVENT_NO")
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Long id;
    @Column(name = "EVENT_OUTPUT_LOG", length = 250)
    private String message;

    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }
}

Standard application.conf config:

db.default.jndiName=DefaultDS
jpa.default=defaultPersistenceUnit
db.default.logStatements=true
# ebean.default="models.*"
evolutionplugin=disabled

When doing a standard select SELECT e FROM Event e I see that it is executing the following query:

select event0_.EVENT_NO as EVENT1_4_,
event0_._ebean_intercept as column2_4_,
event0_.EVENT_OUTPUT_LOG as EVENT3_4_ 
from EVENT event0_

Why is it doing this? I've told it not to use ebeans. I've done a clean compile aswell...but it didn't change anything.

Thank you in advance.

Upvotes: 2

Views: 894

Answers (3)

Ankit Jain
Ankit Jain

Reputation: 808

Removing javaEbean dependency from Build.sbt as suggested by @armk7 solved my issue, however after removing dependency I was getting ClassNotFounException for Ebean classes. This was because I didn't run activator clean, so few class files were importing ebean files. If you face the same issue do :- activator clean activator reload activator compile

Upvotes: 0

Camauu
Camauu

Reputation: 129

Well i had the same problem and i tried removing javaEbean but that resulted in the project not compiling.

I removed the ebean enhacement in the build.sbt ebeanEnabled := false but that didnt work
I removed the line ebean.default="models.* in the application.conf but that didnt work either

Finally i decided to change the name of the package from models to model and that did it, no more selects and null pointers exceptions from non-existent columns.

Upvotes: 2

amrk7
amrk7

Reputation: 1214

Removing javaEbean dependency from Build.sbt seems to solve the problem. I dont know why play is using ebean in the first place when ebeanEnabled is set to false.

Upvotes: 3

Related Questions