facebook

[Closed] Controlling DAO filename in JPA rev-eng

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

    robwunderlich
    Participant

    I’m using ME 5.5 M2. When reveng a DAO for table “equipment”, the generated DAO class is named “EquipmentDAO”. I want the generated class to be named “BaseEquipmentDAO”. I can modify the dao/daohome.vm template to successfully modify the classname, but the file is still generated to “EquipmentDAO.java”. How can I control the output filename?

    Thanks,
    Rob Wunderlich

    #269932 Reply

    Loyal Water
    Member

    Unfortunately this is not possible right now, but we will be adding more control in the future. Sorry about that.

    #269945 Reply

    Steve Prior
    Member

    Just use Java refactoring to rename/move it after it’s been generated. It works fine.

    #269994 Reply

    robwunderlich
    Participant

    The rename approach works until — I regenerate the DAO.
    1. I rename EquipmentDAO to BaseEquipmentDAO.
    2. I Create EquipmentDAO extends BaseEquipmentDAO and add custom methods to to EquipmentDAO.
    3. Run reverse enginering again — I overlay my EquipmentDAO.

    For the time being I’ve settled on creating my subclass as “ExtEquipmentDAO” and leaving the ME generated name as is until this feature is available.

    #270007 Reply

    Steve Prior
    Member

    I no longer use the DAO code which is generated, in fact I use a common abstract generic (JDK 1.5) base class DAO which provides all the functions in the generated DAO. After having done a number of Hibernate projects my process is to use reverse engineering to create only the XML mapping files, then I tweak the XML if I want to change the names of the relationship members, then generate the POJOs from the tweaked XML files. Because of my generic DAO object I only need class specific DAO objects only when I add custom code. I’ve posted this generic DAO code in another topic on this forum. It has saved me huge amounts of redundant code.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: [Closed] Controlling DAO filename in JPA rev-eng

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