Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Defaults for @Table and @Column names

Hello,

Does anyone know if there is a way to change the way that JPA (or the eclipselink implemenation) generates default names for tables and columns when using the @Table and @Column annotations? Or if this is being talked about for version 2 of the JPA spec?

What I'd like is something similar to what Grails does, where they change the camel capped Java names to underscores. Here's an example:

Say you have an EmployeeInfo class and one of the members is defaultHomePhoneNumber.

Current Default in JPA:

Table name:  EMPLOYEEINFO
Column name: DEFAULTHOMEPHONENUMBER

It's kind of hard to read. If we could specify a policy, say the camel caps to underscore policy, it would look like this:

Table name:  EMPLOYEE_INFO
Column name: DEFAULT_HOME_PHONE_NUMBER

Thanks all! And I apoligize if this has been talked about already... I couldn't find anything in the searches.

Best,
Nate


Back to the top