开发者

Surpress Time Generated Comment when Autogenerating Java Classes from Hibernate

I am using Eclipse and JBoss Tools to generate Java classes from existing Hibernate mappings. Whenever the classes get generated, they have a comment at the top of the class that indicates when the class was auto-generated.

I really want to prevent this from happening since it is a nuisance when these classes are under configuration management. I've looked through all the settings I can think of and online and haven't found out how to do this yet. It seems like it should be very si开发者_如何学Gomple, but it hasn't been.

Anyone know how to suppress this comment from being created?


You can edit the tempalte files in the jar file of jboss tools so it does not generate that info. As far as I can remember it uses velocity templates, so you just need to delete that bit from the template files and it wont generate those comments.


When I was using eclipse to generated the POJO's I had the same problem (when working with GIT reporitory). I build a simple program in .Net in order to clean the comments. After I run the hibernate configuration, I run the .exe (it must be located in the same folder of the POJO's files) You can find the code and an .exe app in https://github.com/jaimeimarin/HibernateHeadersCleaner . If you are working with git remember to add an exception in order to commit the tool.

#Add this line to your .gitignore file
!HibernateHeadersCleaner.exe
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜