Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Custom template override apparently not working in STS-3.7.0
PostPosted: Wed Oct 21, 2015 12:40 pm 
Newbie

Joined: Wed Oct 21, 2015 7:33 am
Posts: 2
I am able to reverse engineer classes (domain classes) using the tools in STS-3.7.0 (Spring Tool Suite. built on top of Eclipse Mars), however when I try to use custom templates they do not appear to work, I get the normal generated class. I put my modified templates into all hibernate-tools-4.3.1.Final.jar files I find in my STS installation. There is one in the configuration folder and one in the plugins folder, I modify both. When I run the reverse engineering process again and I see the desired changes I made. To get my modified templates I copied all files found in the pojo folder in that jar file and modified the 4 templates I needed to get the results I was looking for. This would be acceptable for me to continue with, however if I have to start Eclipse with a "-clean" switch, the jar file in the configuration folder gets dumped and the new one that is copied back in contains the original unmodified templates. Any subsequent reverse engineering run produces results that do not contain the modifications I am looking for.

Is there a trick to getting the custom template override to work? On the "Hibernate Code Generation Configuration", I check the checkbox for "Use custom templates (for custom file generation)" and enter a path in the "Template directory:" field by selecting the "Workspace" button and drilling down the the folder I put the templates in, inside my project. That placed "\SQL Server 2008\src\main\resources\templates" in the field. Did I do something wrong?

Or, is there a way to get the templates in the jar files updated locally such that starting STS with the "-clean" switch will bring in jar files that have already been updated with my modifications?


Top
 Profile  
 
 Post subject: Re: Custom template override apparently not working in STS-3.7.0
PostPosted: Wed Oct 21, 2015 2:25 pm 
Newbie

Joined: Wed Oct 21, 2015 7:33 am
Posts: 2
After more searching, I found the source of the corruption of my changes when the "-clean" switch is used. There are 3 runtime jars that contain a hibernate-tools jar for the version of the runtime. I updated the hibernate-tools jars in the runtime jars and even though the "-clean" switch causes the jars to be retrieved again, edited copies are retrieved so I still get my modified output.

It would be better if I could get the override to work, however, I am now working again the way it is...


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.