facebook

Customize reverse engineering names?

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

    Mike Suiter
    Member

    Hi,

    I was wondering if there is a way to customize the class and method names reverse engineering uses? I am using JPA with OpenJPA. For example I would like to:

    1. Change interface from IConnectDAO to ConnectDao.

    2. Change class from ConnectDAO to ConnectDaoImpl.

    3. Change method name from ConnectDAO.save() to ConnectDAO.insert().

    Is this possible and how?

    Thanks.

    #291745 Reply

    Loyal Water
    Member

    msuiter,
    You cannot change the name of the class and interface but you should be able to change the name of the generated method by modifying the rev engg template. You can refer to section 5.5 of this doc for more information.
    http://www.myeclipseide.com/documentation/quickstarts/hibernate/#5-5

    #292865 Reply

    Jeff Walker
    Member

    This message has not been recovered.

    #292866 Reply

    Jeff Walker
    Member

    This message has not been recovered.

    #292877 Reply

    Loyal Water
    Member

    This message has not been recovered.

    #293274 Reply

    Jeff Walker
    Member

    I looked at that quick-start tutorial and looked at the templates. They say they are for 6.5GA. Do you have them for 7.0? Or is there not a difference?

    I’ve looked at the templates that ship with hibernate (they are freemarker templates) and compared them with yours. Is there anything that has the parametrized collections? Is there any reason to use your templates rather than using hibernate to generate the code? I guess with hibernate you don’t get the wizard, but what is the code difference?

    Thanks.

    #293314 Reply

    Jeff Walker
    Member

    Okay, so after more looking, I see something like this in the velocity template:

    #if($jdk5)
    public ${pojo.importType(“java.util.List”)}<${declarationName}> findByExample(${declarationName} instance) {
    #else
    public ${pojo.importType(“java.util.List”)} findByExample(${declarationName} instance) {
    #end

    So how do I get the $jdk5 turned on? I have a 1.5 compliance level on my project. I’m not sure what else I should have to do. I guess I could hack the templates to always do that, but that seems kinda silly, since I could then just use the built-in templates and not worry about upgrades later.

    Thanks.

    #293320 Reply

    Jeff Walker
    Member

    Ok, so it looks like if you turn on the annotated pojo classes, jdk5 is true. That seems kind of random.

    I had to turn off the annotated because it would put the @Temporal annotation on my timestamp fields. That sounds like the right thing to do according to the docs, but when I ran it (from within spring), it gave me an exception.

    #293772 Reply

    Jeff Walker
    Member

    Any ideas here? More info needed?

    #293773 Reply

    Jeff Walker
    Member

    Any ideas here? More info needed?

    #293795 Reply

    Brian Fernandes
    Moderator

    Jeffery,

    Just confirming that the templates for 6.5 and 7 are the same.

    Just so we are on the same page, could you please restate your current problem? Do you want just JDK5 without the annotations (yes, we did tie them together intentionally). Or is your only problem right now the @Temporal annotation? What exception are you seeing with Spring, does the app work if you remove the annotation?

Viewing 11 posts - 1 through 11 (of 11 total)
Reply To: Customize reverse engineering names?

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