[jbosstools-issues] [JBoss JIRA] Commented: (JBIDE-5441) Allow prefix / suffix for generated field names

Vitali Yemialyanchyk (JIRA) jira-events at lists.jboss.org
Mon Jun 14 11:25:46 EDT 2010


    [ https://jira.jboss.org/browse/JBIDE-5441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12535596#action_12535596 ] 

Vitali Yemialyanchyk commented on JBIDE-5441:
---------------------------------------------

I imagine this should be implemented next way:
Hibernate Code Generation Configurations wizard - main page:
"Use custom templates" check box ->
should be possible to extract hibernate-tools core templates in specified directory,
should be possible to ajdust some parameters via GUI so should not be necessary to edit templates by the hands.
i.e. here should be possible to specify suffix/prefix or specify to get suffix/prefix from eclipse settings

> Allow prefix / suffix for generated field names
> -----------------------------------------------
>
>                 Key: JBIDE-5441
>                 URL: https://jira.jboss.org/browse/JBIDE-5441
>             Project: Tools (JBoss Tools)
>          Issue Type: Feature Request
>          Components: Hibernate
>         Environment: eclipse hibernate tools
>            Reporter: Olivier Cailloux
>            Assignee: Vitali Yemialyanchyk
>            Priority: Minor
>             Fix For: 3.2.x
>
>
> When using hibernate tools to generate pojo from an existing database, it would be nice to be able to prefix the generated field names. That is, instead of e.g.
> Code:
> private String name;
> public Criterion(String name) {
>     this.name = name;
> }
> //...
> @Column(name = "name", nullable = false)
> public String getName() {
>     return this.name;
> }
> Having
> Code:
> private String m_name;
> public Criterion(String name) {
>     this.m_name = name; // (or even better, simply m_name = name, but I don't mind so much)
> }
> //...
> @Column(name = "name", nullable = false)
> public String getName() {
>     return this.m_name; // or return m_name;
> }
> Basically, the goal is to allow leaving the compiler option to error when a variable name overrides a field name.
> Currently, it is possible to do so, but not very easy. You need to find somewhere the default templates (e.g. in the Hibernate Tools source code) and edit them and reference them in the Tools config. See the forum post for detailed steps [https://forum.hibernate.org/viewtopic.php?f=6&t=1001437&p=2422311#p2422311].
> I think that the prefix functionality should be optionally available using a configuration property in hibernate tools, because I think it is good practice to enable the compiler complaint when a local variable name overrides a field name, and the current default behavior of hibernate tools (requiring to modify the template, which is not such an easy thing at least for a beginner, IMHO) rather encourages the user to simply uncheck the compiler warning.
> Even more advanced, the hibernate tools, when used as an eclipse plug-in, could use the fields prefix and suffix properties which can be set in Window / Preferences, Java / Code style.
> Thank you for your attention.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbosstools-issues mailing list