[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-929) Enable base class generation

Max Rydahl Andersen (JIRA) noreply at atlassian.com
Fri Apr 13 03:37:04 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HBX-929?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_26705 ] 

Max Rydahl Andersen commented on HBX-929:
-----------------------------------------

so you want one button to enable for all classes, but not have hibernate tools generate the empty subclasses (e.g. it should generate BasePerson, but not Person extends BasePerson, correct?)

Then that is somewhat easy today:

put this in a custom revengstrategy and you will get PersonBase, CustomerBase instead of Person and Customer when using hbm2java.

public Map tableToMetaAttributes(TableIdentifier tableIdentifier) {
				Map m = new HashMap();
				MetaAttribute attribute = new MetaAttribute("generated-class");
				attribute.addValue( settings.getRootStrategy().tableToClassName( tableIdentifier ) + "Base");
				m.put( attribute.getName(), attribute );
				return m;										
			}



> Enable base class generation
> ----------------------------
>
>                 Key: HBX-929
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-929
>             Project: Hibernate Tools
>          Issue Type: New Feature
>          Components: datagen, hbm2java
>    Affects Versions: 3.2beta9
>         Environment: Hibernate 3.2.3
>            Reporter: Norman Franke
>             Fix For: 3.2beta10
>
>
> Using the reverse engineering features, I'd like to be able to have it generate base classes (e.g. TableNameBase) and yet tell Hibernate to use the parent class, e.g. TableName. I read that one can add a meta attribute "generated-class" to do this but (a) there is no way to make this happen via the Eclipse Plugin and (b) even if one modifies the template to add it, it doesn't seem to pick it up (it does end up in the resulting hbm.xml files.) The Run... GUI can't seem to generate Java files from the hbm.xml files either, so one must reverse engineer anyway, which is another annoyance.

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

        



More information about the hibernate-issues mailing list