May 4th, 2011, 03:00 PM
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
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?
May 5th, 2011, 07:54 AM
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?
May 5th, 2011, 08:49 AM
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.
May 5th, 2011, 10:03 AM
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