thx David.

That sounds just like what I will need!
I'll pull up CVS and get it built.
Any documentation or code samples on how to use it?

Unfortunately, there aren't any at this point but the javadoc is fairly good (I hope).



By the way, how involved is it? I don't really wanna spend to much time coding here to achieve the abstraction. :)

It's not involved at all. Just create a Map (I do this with a properties file) and pass it into a MapperFactory. The Map maps a logical String name to a fully qualified class name of a mapper implementation. You implement the Mapper interface by calling your OJB methods which should be easy.


Here's what your application would do to persist a Person object:

Mapper m = factory.getMapper("some name");
m.create(myPersonObject);

Note that the first line can be replaced with this shortcut:
Mapper m = factory.getMapper(Person.class);

if you used the fully qualified class name of Person in your Map (ie. "com.something.Person"="com.something.PersonMapper").

This gives you the separation of your persistence layer technology from your app.

David


Thanks --Alen


----- Original Message ----- From: "David Graham" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, June 20, 2003 4:22 PM Subject: Re: How much should Struts be aware of my persistence system


> I hide my persistence layer by using a project in the commons-sandbox
called
> Mapper. My Actions don't know or care how the objects are persisted, they
> just pass them into the Mapper layer (I actually have a Service layer my
> Actions talk to but you could get rid of that for simplicity).
>
> I initialize the persistence layer in a Struts plugin and, after that,
> nothing in Struts knows about it.
>
> David
>
> >Hi all
> >
> >Where do you think is the best place to initialise your persistence, ORM,
> >system in Struts?
> >Action classes, etc.?
> >I would like to make the Struts framework least aware of my Persistence
> >system.
> >
> >I'm using OJB with PB API and Struts 1.1.
> >
> >Apparently, best practice, when using OJB PB API is to create an instance
> >of
> >Broker before executing business command and then close the Broker after
> >execution.
> >
> >
> >Any ideas as to what particular design I should implement here to get
most
> >out of role separation?
> >
> >--Alen
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> _________________________________________________________________
> Protect your PC - get McAfee.com VirusScan Online
> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to