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:

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 ......}   

This generates development scripts from the above model:

  # --- 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   

I had hoped to do with the resulting development of the script:

  1. The castillo_courses < code> CREATE TABLE script, ck_castillo_courses_course_type should check constraint (1,2,3,4) as defined by CourseType I suspect that this check was generated for development by using the ORDINAL value of my Enums.

  2. The 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.

    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. Public enum InterestType {@EnumValue ("1") ARCHITECTURAL_INFRA (1), @EnumValue ( "2") SOFTWARE_TECH (2), @EnumValue ( "3") INFORMATION_PROCESSING (3), @EnumValue ( "4") ENTERPRISE_SYSTEM (4), @EnumValue ( "5") COMP_INTELLIGENCE (5); private Int values; Interest type {this.value = value;} public int getValue () {return value;}}

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -