Re: OSUser DAO (was: A couple of OSUser questions)

Mike Cannon-Brookes <[email protected]> Sun, 07 Dec 2003 12:53:23 +1100
Newsgroups gmane.comp.java.open-symphony.devel
Message-ID <BBF8D343.3D3F7%[email protected]>
> The DAO appears to be something that Mike added, after your initial checkin I
> presume, so I can understand if there may be a disconnect.  It adds
> significantly to the complexity of the code considering how little
> documentation is available on it.  But it's a cool feature and a "net good"
> in my book.  I quite like the flexibility it provides when it is working.

Yes - this is something I added :) The reason I added it was performance
initially. If you let osuser do your session management for you (with the
default DAOs) the performance stinks terribly. Manage your sessions yourself
and you get a huge (like 100x) performance increase. The problem is that to
manage sessions yourself, you really need to write your own DAOs so that you
can retrieve your own session etc.

I've also tweaked the .hbm.xml files myself for our own app to add caching
and various other things (can't remember exactly what), and having your own
DAOs allows you to do things like that too.

On the PK issue, my biggest problem is performance. Having a non-name PK
means that your caching performance _stinks_. Hibernate caching really gets
fast when you query on the PK a lot - the problem at the moment is that our
PK is not being queried, but rather we're loading groups and users by
finding them. This is a problem I haven't worked out how to solve yet :)

M

> Using the DAO future-proofs applications that want to keep the OSUser library
> up-to-date without having to change their schema if/when the OSUser/Group
> objects change.  Which is good for OSUser developers because the user base
> doesn't have to be so tightly coupled to the database schema.  In my case, I
> just don't want to use the provided user/group objects, and the DAOs allow me
> to change that if they are set up correctly.
> 
> best,
> 
> -b
> 
>> -----Original Message-----
>> From: Matthew E. Porter [mailto:[email protected]]
>> Sent: Saturday, December 06, 2003 2:51 PM
>> To: [email protected]
>> Subject: Re: [Opensymphony-developers] A couple of OSUser questions
>> 
>> 
>> Brian:
>>    I wrote the initial implementation of the Hibernate provider.
>> Granted, that and $.35 will get me a phone call and nothing
>> else.  Here 
>> is my opinion though.
>> 
>>    I don't know if I see a reason to extract interfaces for
>> HibernateUser and HibernateGroup since they are already
>> facaded by User 
>> and Group, respectively.  The only reason I see for doing
>> this would be 
>> to change the PK or the way the HibernateUser and HibernateGroup are
>> associated.
>> 
>>    Regarding changing the PK to a composite type, I don't see
>> a reason 
>> for doing this.  Can you explain why one would need a composite key?
>> Hibernate mainly has this feature for legacy tables, not when one is
>> creating new ones (as in this case).  I believe this is very
>> anti-Hibernate as well.
>> 
>> That doesn't mean I am against it.  I am just not convinced.
>> 
>> 
>> Cheers,
>>    matthew
>> 
>> On Dec 6, 2003, at 1:15 PM, Brian Topping wrote:
>> 
>>> Hi all,
>>> 
>>> Back from some extended time away from the keys.  Doing
>> some travel and
>>> carpentry and things of that nature.  It's fun to be back.
>> Hope all 
>>> your
>>> holidays are going well.
>>> 
>>> Just getting recent versions of the code down and was psyched to see
>>> Hibernate support in OSUser.  I've been working a bit with
>> it in the 
>>> last 24
>>> hours and filed one bug on it last night.  I have the fixes for it,
>>> but it
>>> will take longer for someone to use them than it will for
>> someone with 
>>> IDEA
>>> and a RW connection to CVS to do the changes over again.
>> It took me 
>>> about 30
>>> minutes on this side.
>>> 
>>> The other one, I'm not so sure it's a bug or not, it smells
>> a lot like 
>>> it
>>> belongs in the space of "conventions" rather than bug.  So
>> I thought I 
>>> would
>>> ask for some rationale.
>>> 
>>> In the CMP world, primary keys are objects instead of primitives.
>>> I've been
>>> following that through to Hibernate since it looks like
>> composite types
>>> require that as well.  But BaseHibernateEntity defines the PK as a
>>> primitive
>>> long.
>>> 
>>> Any comments on why this would be beneficial?  Otherwise,
>> my vote is to
>>> convert to object PKs and am happy to do the work on it.
>>> 
>>> thanks,
>>> 
>>> -b
>>> 
>>> 
>>> -------------------------------------------------------
>>> This SF.net email is sponsored by: SF.net Giveback Program.
>>> Does SourceForge.net help you be more productive?  Does it
>>> help you create better code?  SHARE THE LOVE, and help us help
>>> YOU!  Click Here: http://sourceforge.net/donate/
>>> _______________________________________________
>>> Opensymphony-developers mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/opensymphony-developers
>> 
>> 
>> 
>> -------------------------------------------------------
>> This SF.net email is sponsored by: SF.net Giveback Program.
>> Does SourceForge.net help you be more productive?  Does it
>> help you create better code?  SHARE THE LOVE, and help us help
>> YOU!  Click Here: http://sourceforge.net/donate/
>> _______________________________________________
>> Opensymphony-developers mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/opensymphony-developers
>> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive?  Does it
> help you create better code?  SHARE THE LOVE, and help us help
> YOU!  Click Here: http://sourceforge.net/donate/
> _______________________________________________
> Opensymphony-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-developers



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/