facebook

How to control Hibernate Reverese Eng. on naming conventions

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #257962 Reply

    thoism
    Member

    Hello

    I need to know if it’s possible to control the Hibernate code generation to follow some naming conventions I want.
    For example I want to avoid specific prefixes and suffixes on my class creation.
    For example:
    1. If the db table name is TBL_CUSTOMER I would like my resulting Hibernate class to be Customer.\
    2. If the id column of the db table TBL_CUSTOMER is CUSTOMER_ID I would would like the resulting Customer class to have a corresponding property named id
    3. If the table name starts with SPE_CUSTOMER I would like my resulting Hibernate class to reside in a package called com.spe so the class would be “…spe.Customer”

    I checked some velocity templates that the documentation proposes but I dont have much time to spend on this. Can someone please give me some guidelines? Some examples.

    I managed to do what I want with Hibernate Tools and the DelegatingReverseEngineeringStrategy class but Hibernate tools have other limitations on the DAO creation which MyEclipse is perfect on that.
    If there is a way to create DAO objects from Hibernate mappings then my problem is also almost solved.

    Thank you in advance…I am really having a difficult time here with the project deadlines 😯

    #257981 Reply

    Brian Fernandes
    Moderator

    Hi there,

    I know what you’re talking about, but I’m afraid we haven’t yet integrated the DelegatingReverseEngineeringStrategy into MyEclipse.

    The only way you can get what you want right away is to hard code the desired class name for each table on page 3 of the RE wizard. Make sure you use the fully qualified name.

    Sorry about the inconvenience, but we will mostly likely be pulling in all these features into the next MyEcipse release.

    Let us know if you require further assistance,
    Brian.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: How to control Hibernate Reverese Eng. on naming conventions

You must be logged in to post in the forum log in