java - Unexpected Generated Evolution Script for Ebean Model with Enum Field Type -
I'm still learning about Ebean ORM with Play Framework What is the problem with the informal development script! Framework is generated by the Play !, with JDK 1.7 Update 5 64-bit. Framework 2.1.1 . I'm sorry, for the long code snippet of this question. I have two EBIN models resembling the following: This generates development scripts from the above model: I had hoped to do with the resulting development of the script: The The I can explain to anyone who understands, advises, or can help me with this problem .. :) Please do Have a relationship. sample. If all values are in the form of integers In the case of Epsilon, Ebene continues and receives it as an integer instead of wire.
course.Java
package model; Import import.data.validation.Constraints; Import.db.ebean.Model Import; Import javax.preistence *; @Entity @Table (name = "castillo_courses") extends public class course Model {public enum CourseType {Essentials (1), BASIC_INTEREST (2), ADVANCED_INTEREST (3), thesis (4); Private int values; Course type (int value) {this.value = value; } Public int getValue () {return value; }} @ Personal string code id; @ Odds Mandatory private string course_name; @binding Essential private string credit; @ Barriers Type mandatory private course course_type; // EBN finder and other recipients and setter method ......}
CourseInterest.java
Package model ; Import import.data.validation.Constraints; Import.db.ebean.Model Import; Import javax.preistence *; @Entity @Table (name = "castillo_course_interest") extends public square CourseInterest Model {public enum InterestType {ARCHITECTURAL_INFRA (1), SOFTWARE_TECH (2), INFORMATION_PROCESSING (3), ENTERPRISE_SYSTEM (4), COMP_INTELLIGENCE (5); Private int values; Interest type {this.value = value; } Public int getValue () {return value; }} @ Id @ManyToOne @JoinColumn (name = "course_code", referenced column name = "code") private course course; @ Id @ odds Compulsory personal interest type interest_type; // EBN finder and other recipients and setter method ......}
# --- by Ebean DDL # created to prevent Ebean DDL generation, delete this comment and # ---! Up table castillo_courses (code varchar start using 255 creating evolutions) zero, COURSE_NAME varchar (255), varchar (255), course_type integer, obstruction ck_castillo_courses_course_type probe, barrier primary key (code) pk_castillo_courses (in (0,1, 2,3) course_type credit; Table castillo_course_interest (course_name varchar (255), credit varchar (255), course_type integer, interest_type integer faucet, halting ck_castillo_course_interest_course_type check (course_type (0,1,2,3)), constrained ck_castillo_course_interest_interest_type check (interest_type (0 in, 1,2 , 3,4))); Create sequence castillo_courses_seq; Create Order castillo_course_interest_seq; # .....! DOWNS code is not shown
castillo_courses < code> CREATE TABLE script,
ck_castillo_courses_course_type should check constraint
(1,2,3,4)
as defined by CourseType
ORDINAL value of my Enums.
castillo_course_interest
CREATE TABLE script,
code to
> castillo_courses Redefines the field. I hope the script defines the only
course_code column defined by
@JoinColumn annotation. Here is another problem, there is no script to generate primary key constraint , because I have defined two
@ id in the model.
Comments
Post a Comment