ebean

play 2.1.1: Unable to rollback transaction with ebean orm

旧时模样 提交于 2019-12-13 05:43:03
问题 I have problem with understanding how to work with ebean transactions under play 2.1.1. Ebean.execute(txScope, new TxRunnable() { public void run() { Ebean.beginTransaction(); System.out.println("[**] : " + Ebean.currentTransaction()); User user = Ebean.find(User.class, 22); user.setPassword("qweqwe125"); Ebean.save(user); user = Ebean.find(User.class, 22); user.setPassword("qweqwe126"); Ebean.rollbackTransaction(); // or other case //Ebean.currentTransaction().rollback(); } But in this case

Play 2.1.3 application with Maven enhanced models not loading lazy objects

懵懂的女人 提交于 2019-12-13 05:16:50
问题 I have a Play application that is been refactored. The play models have been refactored out to its own Maven project so they can be shared with other projects, and the ant-run plugin is being used to enhance the model classes. The models work ok up to the point that it involves loading the lazy references (I'm using field enhancement with public fields). The references are simply not loaded and an empty object is beeing returned. The example code is: @Entity class A extends Model { @Id

EBean is not doing updates! it's trying to do inserts and failing

做~自己de王妃 提交于 2019-12-12 12:23:23
问题 i have a simple User model like this: package models; import java.util.*; import javax.persistence.*; import play.db.ebean.*; @Entity public class User extends Model { @Id public Long id; public String userName; public String email; public String workPlace; public Date birthDate; @Version public Long version; public static Finder<Long,User> find = new Finder<Long,User>( Long.class, User.class ); public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String

Play 2.2.2 @Transactional of eBean does not rollback transaction in Exception thrown

一个人想着一个人 提交于 2019-12-12 11:05:29
问题 It seems that when using Play Framework 2.2.2 with eBean ORM the @play.db.ebean.Transactional does not rollback transaction when an Exception is thrown. Does someone of you know something about the issue and how it could be solved ? I saw that eBean has a BUG about that issue in their avaje-ebeanorm-agent 3.2.2. : https://github.com/ebean-orm/avaje-ebeanorm/pull/44 which is fixed in version avaje-ebeanorm 3.2.3 Also play 2.2.2 seems use avaje-ebeanorm-agent 3.2.2 and when I change it to

PlayFramework 2 + Ebean - raw Sql Update query - makes no effect on db

这一生的挚爱 提交于 2019-12-12 10:38:07
问题 I have a play framework 2.0.4 application that wants to modify rows in db. I need to update 'few' messages in db to status "opened" (read messages) I did it like below String sql = " UPDATE message SET opened = true, opened_date = now() " +" WHERE id_profile_to = :id1 AND id_profile_from = :id2 AND opened IS NOT true"; SqlUpdate update = Ebean.createSqlUpdate(sql); update.setParameter("id1", myProfileId); update.setParameter("id2", conversationProfileId); int modifiedCount = update.execute();

Play - Deleting a post by id using Ebean permanantly

喜你入骨 提交于 2019-12-12 04:55:07
问题 I am implementing a delete option for a post! I have got model for a post and a deletePostOnly() java method for it to delete it PERMANENTLY using ebean delete() function. But the problem is that it is doing nothing and it is not deleting the post. Following is the picture of the sample post. delete post java method public static Result deletePostOnly(Long postId) { //check if post can be deleted with this user SimplePost post = SimplePost.find.byId(postId); if(post == null) { return

How can I run JUNITs in Eclipse when there is a dependency of EBean enhancing models?

六月ゝ 毕业季﹏ 提交于 2019-12-12 04:07:34
问题 I'm trying to execute junits in a project where the stack is playframework with java, I'm able to run the test by calling sbt test but I would like run the junits in eclipse IDE but keeps showing errors because the models are NOT enhanced. I saw that there is a plugin for eclipse, but it didn't work for me. Do you guys know to do accomplish running that junits in eclipse? As a not I'm a noobie using playframework. Thanks in advance. 回答1: After doing more research, I found that there are two

Why Play Framework uses old Ebean version in the new project templates?

大城市里の小女人 提交于 2019-12-12 02:38:52
问题 I was bashing my head to the wall (almost literally) trying to figure out why I was having this NullPointException problem for the past 17 days (now you believe, don't you ?). So, reading and reading through Play's Documentation I have noticed something ( that I don't know how I haven't noticed before! ). Configuring Ebean Play comes with the Ebean ORM. To enable it, add the Play Ebean plugin to your SBT plugins in project/plugins.sbt: addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "3.0

Play Framework joins and the model

末鹿安然 提交于 2019-12-12 00:44:37
问题 This isn't a problem, its more of a "is this the right approach" kind of deal. So lets say I have a model like this class A extends Model{ @OneToMany(cascade = CascadeType.ALL) public B; } class B extends Model{ String c; } Now I want to access all objects of A that have a particular value of c in their B objects. So should I: Get all objects of B with a certain value c and then find corresponding A's with those objects(if so how, getting confused) Get all objects of A with find.all() then

How to query (EBean & Play Framework) to see if a certain value is in a certain column in a certain table?

不打扰是莪最后的温柔 提交于 2019-12-11 21:01:01
问题 So, I have set up a registration form that saves info to a database in Play Framework. Don't get caught up on the nonexistant password security, I haven't gotten to that. I need a way to check to see if an email is already in the user database. I'm simply not sure how to do that with Ebean. The form model is stored here: https://github.com/Axsel/PonyCentral/blob/master/app/models/RegisterForm.java | In the validation method seen at the bottom of the class I need to be able to check the user