Hi again,
first of all many thanks for help and supervision :-)!
1question:
If I close the persistence broker on each method call I loose the cache just
if I use the ObjectCachePerBrokerImpl.
I'm using ObjectCacheDefaultImpl and not having problems at all (or am I
missing something?).

Anyway, an injection of PB already exists if you are working in a managed
environment.

In the mandragora there is the interface
it.aco.mandragora.startup.OjbPbFactory

and the servlet
it.aco.mandragora.startup.OjbPbStartup

if you put in the web.xml

<servlet>
        <servlet-name>OjbPbStartup</servlet-name>
        <display-name>Ojb PB startup class</display-name>
        <servlet-class>it.aco.mandragora.startup.OjbPbStartup</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
you have available an other Pb from the Service Locator

The servlet OjbPbStartup  is done stealing code from

http://db.apache.org/ojb/docu/guides/deployment.html#pb.factory


so to have a generic startup class, working with all j2ee container (even if
I tried it just with JBoss).

If the property IsInManagedEnvironment=true in Mandragora.properties , the
service locator will give always the
broker = ojbPbFactory.getInstance().defaultPersistenceBroker();
and commit is not done.
So if you use the dao methods inside an ejb, the boundary of the transaction
are the ones of the ejb.

In src/main/resources/META-INF there is an ejb-jar too.

If you think it good you could include this startup class directly in Ojb,
and supervision, upgrade and make it better.



Hans uses swing, so I don't know if he can use it in a J2ee container.


Anyway I will make the PB injection even for no J2ee container, not ejb, and
doing the commit on the base of some mandragora.property properties.

At the very beginning I had all the update, insert deleted method with an
input parameter to specify if to commit or not.
Then I changed idea and removed them. I don't know, maybe I should supply
them again.

As you see there is a lot to work and to think. But first I want to make
documentation as best as possible. I'm working on it all my free time (and
not only :-))

I think the idea of Mandragora is good, even if  is very few think and very
easy.
But putting this small framework around Ojb could push Ojb to the community
someway, I hope this, just because it could make ojb more easy to use and
startup.

I think too that the DAO implementation based on Ojb should be hold by the
same Ojb, so the team of developers and user, can help to write more methods
and improve the existing ones. All get out from a forum discussion is always
better than what get out from a single mind (above all if the mind is
the mine).

I appreciate a lot all help you and hans are giving me (helping Hans he
implicitly helps me to improve) and all suggestions.
I hope this will follow.

The last. Segey in some post said (I think) that the difference between Ojb
and Hibernate success was marketing .
I agree. Why the Ojb cannot appear directly in the apache.org?. To get ojb,
if you don't know it exists, is after 3 hidden links.


Well, tomorrow I have to go out and I'll be back the on October the 3th.

Thanks again  and regards.

Alessandro


















On 9/26/07, Armin Waibel <[EMAIL PROTECTED]> wrote:
>
> Armin Waibel wrote:
> > (...and it's correct) But if you want to take advantage from a session
> > cache on multi findByPrimaryKey calls of the same id or you have to
> > store hundreds of objects it's a bit a "performance anti pattern" to
> > close the PB instance on each method call (this evicts the session
> > cache) or to perform the tx-cycle for each object (this way you can't
> > rollback the whole operation if something went wrong).
> >
> > Think it would be useful to allow some kind of PB "inject" in the DAO
> > implementation (direct or indirect via ServiceLocator) and the DAO never
> > close the "inject" PB instance.
> > On insert, update, delete the DAO implementation:
> > -force a PB-tx (if not running start one and commit/rollback, if running
>
> > don't commit at the end)
> > -or throw an exception if no tx is running on the "inject" PB (more
> > transparent).
> > But never allow object modification without a running tx.
> >
>
> Seems I was too late. As I can see you post a similar suggestion a few
> minutes before my post.
>
> Armin
>
> > regards,
> > Armin
> >
> >>
> >> Anyway remember that Mandragora works with the interface DAO, and if
> you
> >> think in a  better way can be done,
> >> we could write an other DAO implementation, and it is used just
> >> changing the
> >> correspondent entry in Mandragora.properties
> >>
> >> Regards
> >>
> >> Alessandro
> >>
> >> On 9/25/07, Hans Novak <[EMAIL PROTECTED] > wrote:
> >>>
> >>>
> >>>> PersistenceBroker.clearCache();
> >>>> to evict the whole cache
> >>> yes, this works, but will increase the database access a lot.
> >>> You speaks about the possibility, that ojb and mandragora can use the
> >>> same PB ... how ?
> >>> I have a dao class, with the broker.
> >>> This broker is private and will not used in any other classes !?
> >>>
> >>> The other way is to clear only the obj with a oid - but what for oid ?
>
> >>> (a uniqe id from a filed in database ?)
> >>> But this operation willincrase the access to the db too....
> >>> The better way is to use the same broker, i think.
> >>>
> >>> Hans
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> 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]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to