Results 1 to 4 of 4

Thread: Size of generated database tables

  1. #1
    Join Date
    May 2011
    Posts
    3

    Default Size of generated database tables

    Hi Roo experts,

    I am new to roo, but it seems easy to use. When using the persistence addon's, how do you specify the length of the fields to be created in the database?

    I am using Eclipselink with Oracle with STS-2.6.0 (Roo 1.1.3)

    My roo command is this:

    field string --fieldName IncidentSupervisorComments --column INCIDENT_SUPERVISOR_COMMENTS --sizeMax 2000

    The generated java class says this:

    @Column(name = "INCIDENT_SUPERVISOR_COMMENTS")
    @Size(max = 2000)
    private String IncidentSupervisorComments;

    But the generated table in the database has the field defined as

    INCIDENT_SUPERVISOR_COMMENTS VARCHAR2(255)

    It should be defined as VARCHAR2(2000). Every string regardless of max size is being defined as being VARCHAR2(255). I think I must be missing something simple. Any thoughts?

    Cayle

  2. #2
    Join Date
    Apr 2011
    Posts
    28

    Default

    I'm also new to Roo,

    I think it's a Eclipselink (or JPA) issue,

    Some databases support maximum 255 characters for Varchar type, although, Oracle should support up to 4000. Maybe it's compatibility issue?

  3. #3
    Join Date
    May 2011
    Posts
    3

    Default

    I agree it seems to be a problem with Eclipselink as it doesn't happen if I choose to use Hibernate. I haven't tried it with the OpenJPA implementation yet. I don't think there should be a problem with Eclipselink and oracle limits, since it's derived from Oracle's own Toplink.

  4. #4
    Join Date
    May 2011
    Posts
    3

    Default

    It also does the varchar2(255) default length with OPENJPA, so it must be something with the JPA generation. Apparently, there are two additional @Column annotation parameters that roo doesn't know about.

    length - lets you specify length
    columnDefinition - lets you override the type completely.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •