Hi  
 
Thanks for your reply.
 
I'm a newbie of Castor. I have wrote the mapping.xml according to my database(Oracle) definition. I'm not sure that Castor can generate classes files according the mapping file or not. If Castor can't do that, I should write  java file for every class?  
 
Thanks.
 
----- Original Message -----
Sent: Wednesday, March 27, 2002 3:52 PM
Subject: Re: [castor-dev] about source generator

hi Annie,
 
just a small remark on what you said about regenerating the java files...
 
It is a good idea to generate a new class for each class generated by the 'source generator',
this class typically encapsulates the generated one and implements the 'business logic'.
 
I got the idea from J2EE and EJB more specifically, where you have the notion of entity beans and session beans.
In short: the entity beans (in this case the auto-generated classes) are responsible for the persistence (loading/saving/etc...) whereas the session beans (in this case the classes you write yourself) handle the context specific tasks.
 
This allows regeneration of the auto-generated classes since you will never tough them yourself. Small changes such as changes in cardinality of an element or type of an attribute will therefore only need an update of the classes you write yourself (you will first auto-generate everything again, and then patch one not-auto-generated file)
 
I guess most people take this approach.
 
ps: The classes I write myself each take their respective auto-generated class as an argument in the constructor and typically only have one other public method. This, however, is completely up to the developer. It worked from the first time with me using Castor and I must say I was VERY impressed by the result (reusability/maintainability/stability/etc...)
 
 
good luck!
Wouter.
 
I hope my explanation is clear enough...
 
ps: It would be a very cool feature in Castor if the 'session beans' were also generated using some kind om 'mapping' file or something. this would certainly help a lot! Does anybody know if some request like this has been posted before (I did not find it in the archives)
 
 
-----Original Message-----
From: Annie Zhang [mailto:[EMAIL PROTECTED]]
Sent: woensdag 27 maart 2002 23:04
To: [EMAIL PROTECTED]
Subject: [castor-dev] about source generator

Hi, I'm a newbie of Castor. I want to use Castor with Oracle to generate all value objects of tables. What steps should I take? And How the source generator can help me to generate source code?
 
Suppose I have add some code to the generated java files, and in the further, I modify the table definiation. What will happen if I re-generate the java files? All the code I added will lost?
 
Thanks
 
Annie

Reply via email to