ebean

Ebean manual decryption

眉间皱痕 提交于 2019-12-08 10:54:00
问题 I have successfully setup encryption for a field in my model using the answer provided in this SO post. But I would like to know how to manually decrypt the field from SQL client for debugging purposes. I want this information for Mysql (Prod database) and preferably for H2 (dev database). As per E-bean documentation Mysql uses AES_ENCRYPT/AES_DECRYPT and H2 uses ENCRYPT/DECRYPT functions. @Encrypted @Column(columnDefinition="varchar(50)") public String password; Note: I have set the datatype

DdlGenerator constructor needs no arguments?

安稳与你 提交于 2019-12-07 14:18:16
问题 I wanted to unit test my database operation and I found this code. However, I get the followin error: [CityGame] $ test [info] Compiling 2 Java sources to /Users/pmichna/Documents/code/citygame/target/scala-2.10/test-classes... [error] /Users/pmichna/Documents/code/citygame/test/models/BaseModelTest.java:31: error: constructor DdlGenerator in class DdlGenerator cannot be applied to given types; [error] ddl = new DdlGenerator((SpiEbeanServer) server, new MySqlPlatform(), config); [error] ^

manytomany relation not able to save mapped id in mapping table in play framework

牧云@^-^@ 提交于 2019-12-07 13:10:22
问题 I am using play2.2.1 and trying to create a ManyToMany relation between Jobads and JobCategory models. My Jobads.java package models; @Entity public class Jobads extends Model { @Id public Long id; @ManyToOne public Employers employer; @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "jobads_jobcategories") public List<Jobcategories> jobcategory; @ManyToOne public Joblocations joblocations; @Required public String jobtype; @Required public String title; @Required public String text;

Play framework 2.3.x Server Error Cannot register class

寵の児 提交于 2019-12-07 09:01:25
问题 I recently uploaded Play application on server. Problem is that I can ran application through command activator run it compiles and runs fine. When I try to do activator clean stage it also compiles but after target/universal/stage/bin/name_of_myapp it throws an error like Oops, cannot start the server. Configuration error: Configuration error[Cannot register class [models.Movie] in Ebean server] at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:94) at play

play.db package not found in play 2.1.3

孤街浪徒 提交于 2019-12-07 08:04:05
问题 Im trying to follow the play framework ebean tutorial here: http://www.playframework.com/documentation/2.1.2/JavaEbean However when I try to include play.db.ebean.* and try to compile, the package is not found (no play.db package). I have added ebean.default="models.*" to my application.conf Is there anything else I need to do to get the dependency? Is there an equivalent to play deps from play 1.2 for example? The trace: [error] /home/nfv/workspace-scala/scims/app/models/Person.scala:3:

compound key in ebean and play framework

夙愿已清 提交于 2019-12-07 07:07:18
问题 I've just started using Play Framework. After I finished tutorials (covering basic functions) I try setup connection between database and play. One of my relations has schema: CREATE TABLE IF NOT EXISTS `shop`.`CatPath` ( `parentC` INT NOT NULL , `childC` INT NOT NULL , `depth` INT NOT NULL , PRIMARY KEY (`parentC`, `childC`) ) so I built model's class: @Entity public class CatPath extends Model { @EmbeddedId public CatPathKey key; public Long depth; public class CatPathKey { public Long

Play Framework: Error getting sequence nextval using H2 in-memory database

烂漫一生 提交于 2019-12-07 06:30:39
问题 As the title suggests, I get an error running Play 2.0.1 Tests using a FakeApplication w/ H2 in memory. I set up a basic unit test: public class ModelTest { @Test public void checkThatIndustriesExist() { running(fakeApplication(inMemoryDatabase()), new Runnable() { public void run() { Industry industry = new Industry(); industry.name = "Some name"; industry.shortname = "some-name"; industry.save(); assertThat(Industry.find.all()).hasSize(1); } }); } Which yields the following exception: [info

Play Framework Ebean BigDecimal fraction

為{幸葍}努か 提交于 2019-12-07 03:52:08
问题 I am using the Play Framework with Ebean and H2 database. The problem is, the BigDecimal results in the DB script as: sum decimal(38), but what I want is: sum decimal(38,2), I already tried to define the value in the model like that: @Digits(integer=6, fraction=2) private BigDecimal sum; Any ideas? 回答1: You should use @Column(precision = 38, scale = 2) annotation. @Digits annotation seems to be for validation purposes, not for DDL generation. Also 38 looks like overkill. Are you gonna store

How do I describe a bridge table to Ebean?

霸气de小男生 提交于 2019-12-06 22:40:19
问题 Lets say I have these tables: ORDER: id ITEM: id ORDER_ITEM: order_id, item_id The table: ORDER_ITEM is a bridge table between ORDER and ITEM . How do I describe this threesome to Ebean ? I would prefer not to use raw SQL so that I can still create and update these entities. UPDATE Sat Nov 9 02:32:40 UTC 2013 Ok, lets make this problem harder and more representative of my actual situation. The column names dont fit the convention: ORDER: order_number ITEM: item_number ORDER_ITEM: my_order, my

Error reading annotations with composite key in EBean

*爱你&永不变心* 提交于 2019-12-06 17:33:28
Following this link I would like to use OneToMany instead ManyToMany annotation, having middle class with composite key in it using Ebean. I have this error: java.lang.RuntimeException: Error reading annotations for models.SoftwareTagPk This is my SoftwareTagPk class: @Embeddable public class SoftwareTagPk implements Serializable { @ManyToOne private Tag tag; @ManyToOne private Software software; ... } And SoftwareTag class: @Entity public class SoftwareTag extends Model { @EmbeddedId private SoftwareTagPk pk = new SoftwareTagPk(); @Transient public Tag getTag() { return pk.getTag(); } public