Announcement Announcement Module
Collapse
No announcement yet.
Size of generated database tables Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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?

    Comment


    • #3
      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.

      Comment


      • #4
        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.

        Comment

        Working...
        X