Best way to define java class for mapping

2006-03-01 Thread Ashish Kulkarni
Hi
What is the best way to design java class for mapping,
for example suppose i have a SQL querry which join 2-3
tables and returns the data, 
should i design java class to match this SQL querry,
or should i design java class to match tables, and
then create a Map in xml file and then populate data
in 2-3 tables.

Is there a utility which will create java class from
resultset, 
or is there any utility where i may not have to create
java class, like DynaActionForm in struts

ashish

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


RE: Best way to define java class for mapping

2006-03-01 Thread Fullam, Jonathan, ALABS
Hello Ashish,
Regarding a way to not have to create a java class for your result class, you 
could very easily just set your resultClass to a java.util.HashMap.  This will 
be popultated for any results for the key being the name of the field being 
returned and the value being the value.

As far as the best way to design your java classes for mapping; My opinion is 
that you should try to not let your current database design dictate how your 
object model will look.  Design your java objects in a way that makes sense 
from an object oriented point of view.  Decide what makes the best sense in 
terms of what objects you will need perform your business logic.

-Jonathan

-Original Message-
From: Ashish Kulkarni [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 01, 2006 10:16 AM
To: user-java@ibatis.apache.org
Subject: Best way to define java class for mapping


Hi
What is the best way to design java class for mapping,
for example suppose i have a SQL querry which join 2-3
tables and returns the data, 
should i design java class to match this SQL querry,
or should i design java class to match tables, and
then create a Map in xml file and then populate data
in 2-3 tables.

Is there a utility which will create java class from
resultset, 
or is there any utility where i may not have to create
java class, like DynaActionForm in struts

ashish

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com