You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Vinaya Tirikkovalluru <vi...@converge.com> on 2009/07/22 18:03:56 UTC

Abator generated classes and MVC

Hi,

I am using iBatis in my application with JSF and Spring.

 

We are using ABator to generate the objects based on the database
objects.

 

For example.... 

 

Account table will have 

            Account.java

            AccountExample.java

            AccountDAO.java

            AccountDAOImpl.java

I understand that DAO and DAOImpl will be for Model layer.

Where do Account and AccountExample belong?

 

Right now I have AccountBean.java in the view layer which is a copy of
Account.java with additional properties.

Can I move the Account.java and AccountExample.java to the view Layer? 

 

In case I forego iBatis in future... can I still use AccountExample with
just modifying the DAO? Or does AccountExample is specific to Model
layer too?

I think we can have Account.java in view layer as it is a representation
of the table like, DTO.

 

Any ideas?

 

Thanks

Vinaya



This electronic message is intended only for the use of the individual(s) or entity(ies) named above and may contain information which is privileged and/or confidential.  If you are not the intended recipient, be aware that any disclosure, copying, distribution, dissemination or use of the contents of this message is prohibited.  If you received this message in error, please notify the sender immediately.

RE: Abator generated classes and MVC

Posted by Vinaya Tirikkovalluru <vi...@converge.com>.
Thanks for your opinion Jeff.

I agree that DAO and Impl so in controller.
Right now I have a delegate pattern which delegates the calls to DAO from the service layer.

More clearly...

I have a view layer, model layer

Model layer has all the Abator generated code,
View has all the beans, handlers.
Controllers are the services, which in turn call the DAOs

In handlers would it be a good idea to create an example and pass it to the service layer or pass a view bean and create the example in the service layer?

I want to have the modularity of pulling out each layer with minimum changes in the other layers.

Even if I forego iBatis I can use Account.java as a dto. But can I use the DAO/Impl and example? If I cannot, what would be the better approach?

Thanks
Vinaya



-----Original Message-----
From: Jeff Butler [mailto:jeffgbutler@gmail.com] 
Sent: Wednesday, July 22, 2009 2:48 PM
To: user-java@ibatis.apache.org
Subject: Re: Abator generated classes and MVC

My opinion, and it is just opinion, is that Account and AccountExample
are *sort of* like model classes (although Account suffers from the
"anemic domain model" disease).  AccountDAO and AccountDAOImpl are
service classes - to be used by the controller layer.  Ultimately, my
view is that these are all utility classes to be used by the real MVC
classes in your app.

If you forego iBATIS in the future, then AccountExample will be of
little use to you - it is very coupled to iBATIS.

Jeff Butler



On Wed, Jul 22, 2009 at 11:03 AM, Vinaya
Tirikkovalluru<vi...@converge.com> wrote:
> Hi,
>
> I am using iBatis in my application with JSF and Spring.
>
>
>
> We are using ABator to generate the objects based on the database objects.
>
>
>
> For example....
>
>
>
> Account table will have
>
>             Account.java
>
>             AccountExample.java
>
>             AccountDAO.java
>
>             AccountDAOImpl.java
>
> I understand that DAO and DAOImpl will be for Model layer.
>
> Where do Account and AccountExample belong?
>
>
>
> Right now I have AccountBean.java in the view layer which is a copy of
> Account.java with additional properties.
>
> Can I move the Account.java and AccountExample.java to the view Layer?
>
>
>
> In case I forego iBatis in future... can I still use AccountExample with just
> modifying the DAO? Or does AccountExample is specific to Model layer too?
>
> I think we can have Account.java in view layer as it is a representation of
> the table like, DTO.
>
>
>
> Any ideas?
>
>
>
> Thanks
>
> Vinaya
>
> ________________________________
> This electronic message is intended only for the use of the individual(s) or
> entity(ies) named above and may contain information which is privileged
> and/or confidential. If you are not the intended recipient, be aware that
> any disclosure, copying, distribution, dissemination or use of the contents
> of this message is prohibited. If you received this message in error, please
> notify the sender immediately.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org



This electronic message is intended only for the use of the individual(s) or entity(ies) named above and may contain information which is privileged and/or confidential.  If you are not the intended recipient, be aware that any disclosure, copying, distribution, dissemination or use of the contents of this message is prohibited.  If you received this message in error, please notify the sender immediately.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: Abator generated classes and MVC

Posted by Jeff Butler <je...@gmail.com>.
My opinion, and it is just opinion, is that Account and AccountExample
are *sort of* like model classes (although Account suffers from the
"anemic domain model" disease).  AccountDAO and AccountDAOImpl are
service classes - to be used by the controller layer.  Ultimately, my
view is that these are all utility classes to be used by the real MVC
classes in your app.

If you forego iBATIS in the future, then AccountExample will be of
little use to you - it is very coupled to iBATIS.

Jeff Butler



On Wed, Jul 22, 2009 at 11:03 AM, Vinaya
Tirikkovalluru<vi...@converge.com> wrote:
> Hi,
>
> I am using iBatis in my application with JSF and Spring.
>
>
>
> We are using ABator to generate the objects based on the database objects.
>
>
>
> For example….
>
>
>
> Account table will have
>
>             Account.java
>
>             AccountExample.java
>
>             AccountDAO.java
>
>             AccountDAOImpl.java
>
> I understand that DAO and DAOImpl will be for Model layer.
>
> Where do Account and AccountExample belong?
>
>
>
> Right now I have AccountBean.java in the view layer which is a copy of
> Account.java with additional properties.
>
> Can I move the Account.java and AccountExample.java to the view Layer?
>
>
>
> In case I forego iBatis in future… can I still use AccountExample with just
> modifying the DAO? Or does AccountExample is specific to Model layer too?
>
> I think we can have Account.java in view layer as it is a representation of
> the table like, DTO.
>
>
>
> Any ideas?
>
>
>
> Thanks
>
> Vinaya
>
> ________________________________
> This electronic message is intended only for the use of the individual(s) or
> entity(ies) named above and may contain information which is privileged
> and/or confidential. If you are not the intended recipient, be aware that
> any disclosure, copying, distribution, dissemination or use of the contents
> of this message is prohibited. If you received this message in error, please
> notify the sender immediately.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org