-->
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: generate mapping files from java files without annotation??
PostPosted: Fri Apr 20, 2007 4:00 am 
Newbie

Joined: Fri Apr 20, 2007 3:31 am
Posts: 3
Hi :
I am now has some JavaFiles without annotation,I want save Instance of them into DB using hibernate,But I don't know how to generate Hibernate mapping files from java files without annotation(xdoclet tags)
The JavaFiles is upload by another mode,so i can't expect what they shoud be. and i have no table in my DB yet.
I want do things as follow:
1、generate mapping files from Java class files.???
2、create tables automatically
3、 save the instance of these classes into DB.

and I am now trapped by step 1.please help.
Thanks


Top
 Profile  
 
 Post subject: Re: generate mapping files from java files without annotatio
PostPosted: Fri Apr 20, 2007 9:06 pm 
Newbie

Joined: Thu Apr 19, 2007 10:16 pm
Posts: 5
You are not clear that you can't modify the model class or not?

If not, then I don't think it's possible besides create manually or reverse engineer from the database, but you don't have database yet!

If yes, then can you use xdoclet instead of annotation (which is different btw)?

--Frank


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 21, 2007 9:32 pm 
Newbie

Joined: Fri Apr 20, 2007 3:31 am
Posts: 3
the classes is uploaded by another mode,and I load them using classloader.
so,the classes is dynamic.
I want to generate @annotation or generate mapping files dynamicly to saving them by hibernate.
The question is both @annotation and mapping files is not exist!
how can i generate one of them dynamicly?


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 07, 2007 3:22 pm 
Newbie

Joined: Thu Apr 19, 2007 10:16 pm
Posts: 5
shaoanqing wrote:
the classes is uploaded by another mode,and I load them using classloader.
so,the classes is dynamic.
I want to generate @annotation or generate mapping files dynamicly to saving them by hibernate.
The question is both @annotation and mapping files is not exist!
how can i generate one of them dynamicly?


I have to say you have an unique and weird setup here :) If the db exists, you can reverse engineer to generate the mapping files assuming they're corresponded to the classes uploaded, however, it does NOT reserve all schematics (relationships, constraints, etc.). Otherwise, I'm sorry I don't know any other way. (This is ad-hoc but you can try to use reflection on the domain model classes and generate the mapping files, but I would not go there if I were you!)


Top
 Profile  
 
 Post subject: org.codehaus.mojo
PostPosted: Tue May 08, 2007 6:24 am 
Newbie

Joined: Fri Apr 20, 2007 3:31 am
Posts: 3
thanks for your reply again.
I don't know what kind of java files would be uploaded .
and so I can't define the table beforehand.

as I know,HyperJAXB can parse schema to java files and add hibernate annotation to the java files.
so I guess there must be ways parse normal javabean files and add annotation to themself.(I can't use hyperjaxb because i have use jax-ws2.1)
I won't like to use reflection on the domain model classes and generate the mapping files as you said. because it must be complex.
Is there any framework or tools will help??


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.