Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Hibernate

...

Upgrade

Background

As of June 2012, CSF uses Hibernate version 3.2.5

...

(released

...

July

...

2007),

...

so

...

we

...

are

...

well

...

overdue

...

for

...

an

...

upgrade.

...

The

...

most

...

recent

...

Hibernate

...

version

...

is

...

4.1.4

...

(May

...

2012),

...

while

...

the

...

most

...

recent

...

release

...

in

...

the

...

3.x

...

series

...

is

...

3.6.10

...

(Feb

...

2012).

...

Our

...

long

...

term

...

goal

...

is

...

to

...

move

...

to

...

the

...

4.x

...

series,

...

but

...

several

...

issues

...

make

...

this

...

a

...

significant

...

piece

...

of

...

work.

...

One

...

of

...

the

...

issues

...

we

...

have

...

identified

...

in

...

the

...

CSF

...

code

...

that

...

makes

...

a

...

H4

...

problematic

...

is

...

the

...

reliance

...

on

...

Spring's

...

Hibernate

...

3

...

helper

...

classes

...

(HibernateDAOSupport,

...

HibernateTemplate

...

etc.).

...

For

...

several

...

years

...

now

...

(since

...

2007),

...

Spring

...

has

...

been

...

recommending

...

use

...

of

...

the

...

Hibernate

...

Session

...

API

...

rather

...

than

...

the

...

helper

...

classes,

...

and

...

Spring's

...

H4

...

support

...

actually

...

drops

...

these

...

classes

...

altogether.

...

This

...

means

...

that

...

all

...

of

...

our

...

code

...

using

...

the

...

helper

...

classes

...

will

...

have

...

to

...

be

...

refactored

...

before

...

we

...

can

...

move

...

to

...

H4.

...

To

...

prepare

...

ourselves,

...

we

...

will

...

immediately

...

start

...

work

...

on

...

this

...

refactoring,

...

while

...

staying

...

on

...

H3.

...

In

...

brief,

...

here

...

is

...

our

...

plan

...

for

...

moving

...

to

...

Hibernate

...

4:

...

  1. NOW:

...

  1. Refactor

...

  1. current

...

  1. DAO

...

  1. code

...

  1. in

...

  1. CSF

...

  1. (see

...

  1. below

...

  1. for

...

  1. details)

...

  1. SOON

...

  1. BUT

...

  1. NOT

...

  1. YET:

...

  1. Hibernate

...

  1. 3.6

...

  1. SUMMER

...

  1. 2013:

...

  1. Hibernate

...

  1. 4

...

  1. (H4)

...

Immediate

...

Refactoring

...

We

...

will

...

begin

...

refactoring

...

the

...

CSF

...

DAO

...

code

...

immediately,

...

while

...

staying

...

on

...

Hibernate

...

3.2.5.

...

We

...

will

...

remove

...

all

...

references

...

to

...

the

...

Spring

...

Hibernate

...

3

...

helper

...

classes

...

(HibernateDAOSupport,

...

HibernateTemplate

...

etc.)

...

and

...

use

...

unit

...

tests

...

to

...

verify

...

that

...

the

...

current

...

functionality

...

remains

...

intact.

...

This

...

refactoring

...

should

...

not

...

affect

...

any

...

apps

...

using

...

CSF

...

-

...

the

...

interfaces

...

and

...

functionality

...

will

...

remain

...

the

...

same;

...

we

...

are

...

just

...

refactoring

...

underlying

...

implementations.

...

IMPORTANT:

...

as

...

a

...

standard,

...

we

...

should

...

make

...

sure

...

all

...

DAOs

...

extend

...

the

...

MIT

...

class

...

AbstractHibernateDAO.

...

This

...

class

...

provides

...

an

...

abstraction

...

barrier

...

between

...

our

...

code

...

and

...

the

...

underlying

...

ORM

...

API.

...

These

...

are

...

the

...

details

...

involved

...

in

...

the

...

refactoring

...

phase:

...

1.

...

List

...

all

...

DAOs

...

in

...

CSF

...

that

...

extend

...

AbstractHibernateDAO.

...


2.

...

Refactor

...

AbstractHibernateDAO,

...

method

...

by

...

method:  

Code Block
  
{code}
   DO for each method (e.g. "get"):
      DO for each CSF DAO in above list that uses the method (e.g. "get"):
         Verify there is a unit test exercising the DAO's "get" method
         If there is no unit test, create one and verify it passes
         Refactor the AbstractHibernateDAO method to use Hibernate's Session API and not Spring's HibernateTemplate
      END DO
   END DO
{code}
   At the end of this step, the 

   At the end of this step, the AbstractHibernateDAO's

...

only

...

remaining

...

dependency

...

on

...

the

...

Spring

...

H3

...

helper

...

classes

...

should

...

be

...

"extends

...

HibernateDAOSupport".

...

3.

...

Refactor

...

DAO

...

classes

...

that

...

extend

...

HibernateTemplate.

...

For

...

each

...

such

...

DAO

...

class,

...

  • if

...

  • any

...

  • methods

...

  • do

...

  • not

...

  • have

...

  • unit

...

  • tests,

...

  • create

...

  • the

...

  • tests

...

  • and

...

  • verify

...

  • they

...

  • pass

...

  • make

...

  • the

...

  • DAO

...

  • class

...

  • extend

...

  • AbstractHibernateDAO

...

  • replace

...

  • any

...

  • references

...

  • to

...

  • Spring's

...

  • HibernateTemplate

...

  • with

...

  • Session

...

  • API

...

  • verify

...

  • that

...

  • unit

...

  • tests

...

  • still

...

  • pass

   At the end of this step, there should be no more references in CSF to the Spring Hibernate 3 helper classes.

4. Refactor DAO classes that are plain POJOs (i.e.

...

that

...

do

...

not

...

extend

...

any

...

other

...

class):

...

  • if

...

  • any

...

  • methods

...

  • do

...

  • not

...

  • have

...

  • unit

...

  • tests,

...

  • create

...

  • the

...

  • tests

...

  • and

...

  • verify

...

  • they

...

  • pass

...

  • make

...

  • the

...

  • DAO

...

  • class

...

  • extend

...

  • AbstractHibernateDAO

...

  • verify

...

  • that

...

  • unit

...

  • tests

...

  • still

...

  • pass