Skip to Content.
Sympa Menu

grouper-dev - Hibernate3 ---- RE: [grouper-dev] Questions about interoperability of multiple Hibernate3 databases

Subject: Grouper Developers Forum

List archive

Hibernate3 ---- RE: [grouper-dev] Questions about interoperability of multiple Hibernate3 databases


Chronological Thread 
  • From: Chris Hyzer <>
  • To: Dave Donnelly <>, Grouper Dev <>
  • Subject: Hibernate3 ---- RE: [grouper-dev] Questions about interoperability of multiple Hibernate3 databases
  • Date: Sun, 17 Feb 2008 03:48:16 -0500
  • Accept-language: en-US
  • Acceptlanguage: en-US

Hey,

 

I upgraded hibernate3 in grouper, and all unit tests pass.  Below are steps to configure grouper to use hib3 (try it out, let me know if there are issues).  The UI seems to work fine with hib3 too (did minimal testing).

 

I believe the current plan is that people are expected to upgrade to hib3 with the new grouper release this spring, and that hib2 will be “experimental”.

 

https://wiki.internet2.edu/confluence/display/GrouperWG/Hibernate+and+data+layer+updates

 

Dave, re pooling with hib3, I was leaving this step to the end of the Hib3 upgrade… and it turned out (after copious painful debugging), that this was the source of problems (can’t say you didn’t warn me J ).  Apparently the default pool with hibernate doesn’t rollback connections on return to pool, so sometimes you get connections in the middle of old transactions and they see inconsistent data.  This made unit tests fail (thankfully it was reproducible).  Anyways, now with c3p0 things work fine.

 

Couldn’t have figured it out without p6spy db debugging… (and your email below! J )

 

https://wiki.internet2.edu/confluence/display/GrouperWG/Database+debugging+with+p6spy

 

Now I will start on the other tasks: inverse of control and transactions.

 

Kind regards,

Chris

 

Ps. Still need to commit default config files to grouper, can do this after more testing occurs.  Also, on wed we can discuss the defaults for the c3p0 pool…  maybe it should match the old one, but right now I have it erring on the side of reliability…

Pps. Instructions to upgrade to hib3 (master doc is the Hibernate link above).  Note, re the jar updates, lets discuss how we want the final version to look and I can adjust.  Specifically I changed the i2mi common to upgrade ehcache and asm (the grouper jar, not the i2micommon project)…  I pre and post tagged the upgrade in cvs…

 

    1. Sync and get the new jars: hibernate3.2.6, i2micommon, asms, cglib, c3p0, ehcache, backport-util-concurrent.  Remove old jars (e.g. hibernate.3.2.5)

    2. Change the grouper.properties to use hib3 dao factory

#dao.factory=edu.internet2.middleware.grouper.internal.dao.hibernate.HibernateDAOFactory
dao.factory=edu.internet2.middleware.grouper.internal.dao.hib3.Hib3DAOFactory

    3. Change the grouper.hibernate.properties to use the hib3 ehcache, and hib3 dialect (in this example, mysql, but change this to whatever DB driver type you are using)

#hibernate.dialect                     = net.sf.hibernate.dialect.MySQLDialect
hibernate.dialect                     = org.hibernate.dialect.MySQL5Dialect

#hibernate.cache.provider_class        = net.sf.hibernate.cache.EhCacheProvider
hibernate.cache.provider_class        = org.hibernate.cache.EhCacheProvider

    4. You must start using c3p0 database pooling (this is the only one we unit test with grouper with).  This means changing the grouper.hibernate.properties (feel free to set the c3p0 pool settings as you see fit.  Below is a safe version which should perform fine, but you can tune it to err on the side of performance if you like:

# Use DBCP connection pooling
#hibernate.dbcp.maxActive              = 16
#hibernate.dbcp.maxIdle                = 16
#hibernate.dbcp.maxWait                = -1
#hibernate.dbcp.whenExhaustedAction    = 1

# Use c3p0 connection pooling (since dbcp not supported in hibernate anymore)
# http://www.hibernate.org/214.htmlhttps://wiki.internet2.edu/confluence/images/icons/linkext7.gif, http://www.hibernate.org/hib_docs/reference/en/html/session-configuration.htmlhttps://wiki.internet2.edu/confluence/images/icons/linkext7.gif
hibernate.c3p0.max_size 16
hibernate.c3p0.min_size 0
#seconds
hibernate.c3p0.timeout 100
hibernate.c3p0.max_statements 0
hibernate.c3p0.idle_test_period 100
hibernate.c3p0.acquire_increment 1
hibernate.c3p0.validate false

    5. Check your log4j.properties, if you have TRACE log on hibernate, change to ERROR.  If you have net.sf.hibernate, might want to change to org.hibernate.  Otherwise ignore.

log4j.logger.org.hibernate                                       = ERROR, grouper_error

 

 

 

From: Dave Donnelly [mailto:]
Sent: Wednesday, February 06, 2008 3:47 PM
To: Grouper Dev
Subject: Re: [grouper-dev] Questions about interoperability of multiple Hibernate3 databases

 

Chris, and others interested in Hibernate3,

If you are relying on the DBCP connection pool lib that came
with Hibernate2, be aware that their DBCPConnectionProvider
class is no longer available in Hibernate3. Their documentation
states that a connection provider is specified in the hibernate
config file, and through a heuristic search, determines which
connection provider to use. If for any reason it fails to
find one (and if you're using 'hibernate.dbcp.*' it will fail)
then Hibernate3 silently uses its own internal, less-than-production-
quality connection pool. I found this out when the DBA at Stanford
asked me why Signet's DB had 40 open connections all the time.

One of the Hibernate developers assured some mail list that use
of DBCP is possible. He stated that none of Hibernate dev team
uses DBCP (so neither should you ;-), and removed it from Hibr3.
To use it you will need to write your own implementation of
org.hibernate.connection.ConnectionProvider. I found a few partial
implementations on the web but wimped-out and simply used the C3P0
connection pool that came with Hibernate3. Seems to work fine so far.
Note that there are 6 C3P0 configuration settings that _must_ be in
the Hibernate3 config file
(@see http://www.mchange.com/projects/c3p0/index.html#hibernate-specific)

--Dave Donnelly
Signet Project




Chris Hyzer wrote:

They should probably remove their own hib3 jars and do any upgrade steps hibernate recommends to get on the same (latest and greatest) version that comes with grouper if they aren't already on it.  Typically this is not a lot of work if any, but good to know about...  incidentally, maybe we shouldn't use any features in 3.2 that aren't in 3.1 or 3.0 (if possible) to make things a little more forgiving...
 
http://www.hibernate.org/250.html
 
Chris
 
  
-----Original Message-----
From: Kathryn Huxtable []
Sent: Wednesday, February 06, 2008 2:26 PM
To: Grouper Dev
Subject: [grouper-dev] Questions about interoperability of multiple
Hibernate3 databases
 
Given that the Grouper API is likely to be moving to Hibernate3, a
move I support, how will this interoperate should someone write a
program that uses both the Grouper API and another database or API
that also uses Hibernate3?
 
At KU, they have a web interface that stores rules for populating
groups from KU's IdMS database. KU uses Hibernate3 for the IdMS access
code, but the Grouper they're using still uses Hibernate2, so there's
no conflict at the moment.
 
Will this be a problem in the future?
 
-K, who talks to people at KU about once a month, just to keep in
touch.
    
 
  



Archive powered by MHonArc 2.6.16.

Top of Page