-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: hbm2java - How to customize the java code created!
PostPosted: Sat Jul 24, 2004 4:49 am 
Beginner
Beginner

Joined: Tue Apr 06, 2004 6:13 pm
Posts: 39
Location: Pune, Maharashtra, INDIA
Hi,

I hv finally been successful in reverse enginnering my oracle Db into POJOs retaining the XDoclet tags.

I would like to know how to customize the generated Java code.

eg. My table is named TB_PRODUCT and middlegen+hbm2java generate a TbProduct.hbm.xml and TbProduct.java

I wud prefer to have it as Product.java.

Secondly the generated Xdoclet tags have 12 spaces from the left.
I wud prefer to have TABs or at least a 3-4 spaces at max.

Quote:
/**
* @hibernate.property
* column="INSTITUTION_ID"
* unique="true"
* length="32"
* not-null="true"
*............. -> Too many spaces! I wish to reduce this but unfortunately it does not show in the post in a browser.
*/



Any clues ?

_________________
thks
G1


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 24, 2004 6:15 am 
Beginner
Beginner

Joined: Tue Apr 06, 2004 6:13 pm
Posts: 39
Location: Pune, Maharashtra, INDIA
Further to this I doscovered,

hbm2java does not carry fwd the property type of the element/ column into the XDoclet tag of the generated Java code.

For instance (extract from .hbm.xml file is)
Code:
    <property
        name="lastUpdatedBy"
        type="java.lang.String"
        column="LAST_UPDATED_BY"
        not-null="true"
        length="32"
    >
    </property>

creates an Xdoclet tag in java code as
Code:
    /**
     *            @hibernate.property
     *             column="LAST_UPDATED_BY"
     *             length="32"
     *             not-null="true"
     *         
     */

type = "string" is missing!

How to correct this!

_________________
thks
G1


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 25, 2004 1:50 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
eh - hbm2java does not yet carry or generate ANY xdoclet information - it is all something that is placed in meta attributes (such as class-description) by e.g. middlegen.

hbm2java will probably first get this capability in H3 since it require a tad more information from the hbm.xml files than the current hbm2java built-in parser reads.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 26, 2004 1:47 am 
Beginner
Beginner

Joined: Tue Apr 06, 2004 6:13 pm
Posts: 39
Location: Pune, Maharashtra, INDIA
Oh!

In that case can the one edit the meta information/ attributes that MiddleGen maintains.

Cud some from the MiddleGen team look at this.
(as MiddleGen on sourceForge does not have a forum of its own so posting it here)

_________________
thks
G1


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 26, 2004 4:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Sure - Have a look at the velocity script that Middlegen creates the output from - edit it as you please.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.