Is there a Hibernate template?

how can I customize the hibernate files(POJO,XML) generated by IDEA? Is there a template file can be modified?

5 comments
Comment actions Permalink

zypro wrote:

how can I customize the hibernate files(POJO,XML) generated by IDEA? Is there a template file can be modified?


I'm not sure exactly what you're asking for but I've been doing a bit of
Hibernate work. I would be happy to share some sample files.

Donald

0
Comment actions Permalink

Hello.

Sorry for reviving this quite old thread, but I have the same question, and I decided to post it here.

Is there any way to configure way IDEA 8.1 generates hibernate class mappings? Precisely:

  • to generate <property column="..."/> instead of <property><column name="..."/></property>
  • to generate one hbm.XML file per class (with the same name and location as VO class) instead of one XML file for all mappings?
  • Is there any way to add more java types to drop-down list in "Import Database Schema" - such as java.lang.BigDecimal, java.util.Date? Custom types can be inserted, but must be copy-pasted or manually typed
  • Is there any way to tell IDEA to map certain database column types to certain java types? I would like to have Oracle varchar2 type mapped to java.lang.String (instead of char[]), date to java.util.Date (instead of java.lang.String) by default etc.


TIA for any input.

0
Comment actions Permalink

Hello Jan,

Jan wrote:

Hello.

Sorry for reviving this quite old thread, but I have the same question, and I decided to post it here.

Is there any way to configure way IDEA 8.1 generates hibernate class mappings? Precisely:

  • to generate <property column="..."/> instead of <property><column name="..."/></property>

For the time being no.
I can easily do this for single column case in the upcoming 8.1.1 if
nobody cares for other column tag options (type, length, precision, ..)

  • to generate one hbm.XML file per class (with the same name and location as VO class) instead of one XML file for all mappings?

No, please file a JIRA ticket for these two items.

  • Is there any way to add more java types to drop-down list in "Import Database Schema" - such as java.lang.BigDecimal, java.util.Date? Custom types can be inserted, but must be copy-pasted or manually typed


BigDecimal is available in 8.1.1 EAP.
I've added java.util.Date as an option (from the next EAP).

  • Is there any way to tell IDEA to map certain database column types to certain java types? I would like to have Oracle varchar2 type mapped to java.lang.String (instead of char[]), date to java.util.Date (instead of java.lang.String) by default etc.


There was an issue with default type mappings, it has been already
resolved in 8.1.1.

Regards,
Gregory Shrago

0
Comment actions Permalink

For the time being no.
I can easily do this for single column case in the upcoming 8.1.1 if
nobody cares for other column tag options (type, length, precision, ..)

Thanks. I think two way generation (property with column attribute/ property with column tag nested) is sufficient (for me). Although checkboxes with optional column attributes wouldn't hurt .

No, please file a JIRA ticket for these two items.


OK

0
Comment actions Permalink

No, please file a JIRA ticket for these two items.

There it is:

http://www.jetbrains.net/jira/browse/IDEA-22341

0

Please sign in to leave a comment.