ebean

Play Framework: PersistenceException: The type is not a registered entity? (Ebean)

坚强是说给别人听的谎言 提交于 2019-11-30 05:25:47
I'm following the Play Framework 2.0 tutorial for Java and get this error when trying to save an ebean Model ( task.save() ). [PersistenceException: The type [class models.Task] is not a registered entity? If you don't explicitly list the entity classes to use Ebean will search for them in the classpath. If the entity is in a Jar check the ebean.search.jars property in ebean.properties file or check ServerConfig.addJar().] Check these 3 points : Your model is annotated with @Entity (javax.persistence.Entity) Your model extends Model (play.db.ebean.Model) Ebean is enable in your application

Ebean ManyToMany query

╄→гoц情女王★ 提交于 2019-11-30 03:46:19
问题 I have two classes, user and car. Both have ManyToMany mapping to each other. User: @Entity public class User extends Model { private int year; @ManyToMany(cascade=CascadeType.ALL) private List<Car> cars; } Car: @Entity public class Car extends Model { @ManyToMany(mappedBy = "cars", cascade=CascadeType.ALL ) private List<User> users; } Using ebean, I would like to query only those cars from year 1999 that have give user in their list. I do not want to iterate over the user's car list in Java

Multiple Databases with Play Framework 2.1.x

人盡茶涼 提交于 2019-11-30 02:00:59
I have 2 databases that I need to connect to. I can easily connect to them in the application.conf file like so: db.default.driver=org.postgresql.Driver db.default.url="jdbc:postgresql://localhost/db1" db.default.user=postgres db.default.password="password" db.secondary.driver=org.postgresql.Driver db.secondary.url="jdbc:postgresql://localhost/db2" db.secondary.user=postgres db.secondary.password="password" ebean.default="models.db1.*" ebean.secondary="models.db2.*" I have my model classes in those packages, and it DDL generates the tables properly. The problem lies in actually working with

Play Framework: PersistenceException: The type is not a registered entity? (Ebean)

时间秒杀一切 提交于 2019-11-29 03:45:52
问题 I'm following the Play Framework 2.0 tutorial for Java and get this error when trying to save an ebean Model ( task.save() ). [PersistenceException: The type [class models.Task] is not a registered entity? If you don't explicitly list the entity classes to use Ebean will search for them in the classpath. If the entity is in a Jar check the ebean.search.jars property in ebean.properties file or check ServerConfig.addJar().] 回答1: Check these 3 points : Your model is annotated with @Entity

filterMany for Play 2 returns all results

两盒软妹~` 提交于 2019-11-28 12:23:14
I am using Play 2.0.2 with ebean. In Info class, I defined @ManyToMany(fetch=FetchType.EAGER) private Set<MemberInfo> members; private Date createdDate = new Date(); And MemberInfo has memberId field. When I do public static Finder<Long,Info> find = new Finder<Long,Info>(Long.class, Info.class); find.fetch("members") .where().filterMany("members").eq("memberId", memberId) .order().desc("createdDate") .findList(); It returns all Info , without checking memberId of members . What did I do wrong? Thanks. filterMany() doesn't filter parent results by children's expressions (both has separate

How to create custom INSERT INTO query in Ebean?

南笙酒味 提交于 2019-11-27 14:48:00
I need to fill a table with large amount of data so I don't want to find related objects, but just put numeric values of them. For this I'd build a simple query ie: INSERT INTO article_category (article_id, category_id) VALUES (2,12); anyway can't find a way to do this with Ebean, I was trying: RawSql rawSql = RawSqlBuilder .parse("INSERT INTO article_category (article_id, category_id) VALUES (2,12)") .create(); however that throws an exception: [RuntimeException: Error parsing sql, can not find SELECT keyword in:INSERT INTO article_category (article_id, category_id) VALUES (2,12)] How can I

filterMany for Play 2 returns all results

回眸只為那壹抹淺笑 提交于 2019-11-27 06:57:09
问题 I am using Play 2.0.2 with ebean. In Info class, I defined @ManyToMany(fetch=FetchType.EAGER) private Set<MemberInfo> members; private Date createdDate = new Date(); And MemberInfo has memberId field. When I do public static Finder<Long,Info> find = new Finder<Long,Info>(Long.class, Info.class); find.fetch("members") .where().filterMany("members").eq("memberId", memberId) .order().desc("createdDate") .findList(); It returns all Info , without checking memberId of members . What did I do wrong

Why Ebean returns null for no reason?

↘锁芯ラ 提交于 2019-11-27 03:35:31
问题 Using Play Framework, I have a model like this : class MyModel extends Model { // Some columns @ManyToOne public OtherModel other; public OtherModel getOther() { return other; } } For a reason I can't understand, if I call myModel.other OR myModel.getOther() ( myModel being an instance of MyModel ), I got a Null value, even if it should return an instance of OtherModel ! Moreover, if I change the getOther() methods to this : public OtherModel getOther() { console.log (String.valueOf(other));

Steps needed to use MySQL database with Play framework 2.0

◇◆丶佛笑我妖孽 提交于 2019-11-26 21:24:43
I'm new to Play framework. I'm trying to configure MySQL database as a datasource to be used with Play Ebeans. Could you some one please explain the steps that are needed to configure MySQL with Play 2.0 framework (like, downloading drivers, adding dependency etc). Look at this page from Play's documentation. It says: Other than for the h2 in-memory database, useful mostly in development mode, Play 2.0 does not provide any database drivers. Consequently, to deploy in production you will have to add your database driver as an application dependency. For example, if you use MySQL5, you need to

Play Framework 2.0 and Ebean SQL logging

白昼怎懂夜的黑 提交于 2019-11-26 14:29:33
问题 I want to examine what SQL statements are generated by Ebean to find out why certain exceptions (related to SQL syntax) are occurring in my Play 2.0 application. Is there a way to log the SQL statements generated by Ebean in Play Framework 2.0? In Play 1.x, there is a jpa.debugSQL config option, which if set to true, will do exactly this. Does a similar setting for Ebean exist for Play 2.0? The documentation page about Ebean of Play 2.0 is still a bit scarce. What I have tried so far: I have