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