Questions tagged [ebean]

Ebean is an open source Object Relational Mapping tool. It's goal is to provide a simpler alternative to JPA (Java Persistence API) implementations such as Hibernate and Eclipselink.

Ebean is an open source Object Relational Mapping tool.

It's goal is to provide a simpler alternative to JPA (Java Persistence API) implementations such as Hibernate and Eclipselink.

It does this by providing a “sessionless” API and a simpler query language. That means:

  • No Session Object (or UnitOfWork or EntityManager)
  • No Attached or Detached Beans
  • No merge(), persist(), flush(), or clear(). Instead Ebean has save() and delete()

Ebean, just like JPA has a Persistence Context but has some architectural differences to allow it to have a different approach to the entity bean lifecycle and removing the need to manage EntityManagers.

Why Ebean? ... why different from JPA?

Ebean uses the JPA Mapping annotations and will follow those very closely.

However, Ebean has been architected and built from a different perspective than JPA. The Architectural and Query language differences are reasonably fundamental to both Ebean and JPA so its hard to see these differences going away anytime soon.

JPA is architected to use an “EntityManager” which closely matches a Hibernate “Session” and a Toplink “UnitOfWork”. This brings with it the concepts that an entity bean can be attached or detached from the EntityManager (with associated merge, flush clear operations etc). If the EntityManager is used across multiple Transactions the EntityManager needs to be managed typically by a EJB Session Bean, Seam, Spring or similar container/framework.

Ebean is architected to not require an EntityManager (or Session or UnitOfWork object) with the goal of making it easier to use and to remove the requirement to manage EntityManager objects (Aka a different approach to Lifecycle management).

Although Ebean doesn't have a EntityManager it DOES have a “Persistence Context” (like JPA) and by default in Ebean the persistence context is transaction scoped and automatically managed.

1101 questions
0
votes
1 answer

Exceptions with Ebean OneToMany

Am Using Ebeans with Play2.0.2 I have two Models like this : @Entity @Table(name="GRP_MST") public class GroupMst extends Model { @Id @Constraints.Required @Formats.NonEmpty public String groupid; ...... @OneToMany(cascade = CascadeType.ALL) public…
Suave Nti
  • 3,721
  • 11
  • 54
  • 78
0
votes
0 answers

where can I find/modify the default precision of mysql floats?

I ran into an issue where it seems that mysql 5.1.63 (on a debian) stores 2/3 as 0.666666666666667 and on mysql 5.5.21 (on a mac) as 0.6666666666666667 as I happen to use Ebean to manage my database interactions, I need the mysql DOUBLE…
Daniel
  • 2,642
  • 1
  • 26
  • 28
0
votes
1 answer

how to get one side object value when query many side?

I use play framework to do web sample excise and meet a problem related to manyToOne. My object relationship is as follow: @Entity @Table(name="account") public class User extends Model{ @Id @Constraints.Required …
kaiven
  • 11
  • 2
0
votes
1 answer

Does play2 framework uses ehcache wrapper on avaje ebeans bean cache?

Does play2 framework uses ehcache wrapper on avaje ebeans bean cache ? It seems to me that ehcache have to be more efficient, and it's not hard to implement wrapper around standart bean cache. But I don't know how play2 working with the bean cache…
eox425
  • 113
  • 2
  • 8
0
votes
1 answer

Overzealous @Constraints.Required enforcement on update in Play 2.0

I'm trying to make Play stop complaining when updates don't specify required fields in JSON requests. The required fields already have values which I don't want to change, so I shouldn't have to specify them again. stripped down…
Brad Mace
  • 27,194
  • 17
  • 102
  • 148
0
votes
1 answer

EBean with Scala on SBT (InterruptedException: sleep interrupted)

I am trying to run EBean with Scala on SBT and I get an error. This is the code (a test from: http://www.avaje.org/ebean/getstarted_props.html#test): object Main extends App { val sql = "select count(*) as count from dual" val row =…
Etam
  • 4,553
  • 10
  • 40
  • 60
0
votes
1 answer

Ebean is not creating dbfile, how do i get it to work?

i have a class User which extends Ebean Model. And i defined a dbfile in my application.conf and by starting h2, it is creating the dbfile. my quesion is: do i have to create my User Table manually in H2 Console in DB? or does Ebean create it…
doniyor
  • 36,596
  • 57
  • 175
  • 260
0
votes
1 answer

Using MySQL "SET" column with Ebean ORM

I'm trying to recreate one of our web apps using Play 2.0 with Ebean and I've hit a road block. I can't figure out how to map MySQL's SET type to a field in the model. I've gotten ENUM columns working using the @Enumerated(EnumType.STRING)…
Brad Mace
  • 27,194
  • 17
  • 102
  • 148
0
votes
0 answers

Playframework 2 with Oracle throws InvocationException

When running the "java/computer-database" sample with an Oracle db instead of the H2 one, Computer.find.byId() results in "com.sun.jdi.InvocationException occurred invoking method.". The Application.list() is showing the correct data. I have this in…
P. Harkink
  • 13
  • 5
0
votes
1 answer

Retrieve a list of date from a SQL query

Is it possible to retrieve a List instead of a List using Ebean ? For example, I have this model: Days(id, name, day); I'd like to do something like: List dates = Ebean.createQuery(Date.class, "SELECT day FROM…
Cyril N.
  • 38,875
  • 36
  • 142
  • 243
0
votes
1 answer

ebean in play 2 framework with SQL dialect

I'm trying to establish friendship between Teradata 13.10 and play 2 framework using ebean ORM layer. My app does try to query DB: select t0.workflow_id c0, t0.CHNL_TYPE_CD c1, t0.WORKFLOW_NAME c2, t0.INFO_SYSTEM_TYPE_CD c3, t0.FOLDER_NAME c4 from…
Capacytron
  • 3,425
  • 6
  • 47
  • 80
0
votes
1 answer

Play 2 evolutions apply blob and bytea for test and production

I created a bean under play 2.0 and evolutions would create a 1.sql DDL for me. This is the entity contains blob type: @Entity @Table(name="image_info") public class ImageInfo extends Model { ....... @Constraints.Required private Blob…
0
votes
1 answer

How to save a HashSet in a ebean entity?

I want to put an extra set in an entity. But with Ebean seems to not handle it and always gives me null when I read it. @Entity public class MyData extends Model { @ElementCollection public Set extra = new HashSet(); }
fxp
  • 6,792
  • 5
  • 34
  • 45
0
votes
2 answers

OneToMany returns 1 result when no result should be returned?

I have a two models, the second is mapping to the same first model twice, with specific values (it has the role of a ManyToMany table with added values) : public class ModelB extend Model { public ModelA parent; public ModelA child; …
Cyril N.
  • 38,875
  • 36
  • 142
  • 243
0
votes
1 answer

How to validate constraints of ManyToOne relations?

I've got two models with 1:n relation and want to use form validators. If I choose an option from the select, the correct id of the element is stored on the database. But if I leave it -- Choose a game--, NULL is stored although the game property is…
twes
  • 307
  • 4
  • 9