Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

[16:22:22 CDT(-0500)] <athena> i told him that probably most of the spring context stuff is at the bottom of persistenceContext.xml - does that sound right?

[16:23:42 CDT(-0500)] <EricDalquist> hi

[16:23:46 CDT(-0500)] <EricDalquist> ah yeah

[16:23:56 CDT(-0500)] <EricDalquist> though uPortal's use is fairly customized

[16:24:10 CDT(-0500)] <EricDalquist> but in generally you use spring's local entity manager factory

[16:24:17 CDT(-0500)] <EricDalquist> create a persistence.xml that goes in META-INF

[16:24:32 CDT(-0500)] <EricDalquist> and then in code you annotate a setter/field with @PersistenceContext

[16:24:53 CDT(-0500)] <EricDalquist> at runtime the EntityManager reference provided by the @PersistenceContext annoation is what you use to do your JPA work

[16:25:30 CDT(-0500)] <Naenyn> hhmm... ok

[16:25:32 CDT(-0500)] <EricDalquist> though this is uPortal specific the managed object stuff is pertinent to any app: https://wiki.jasig.org/display/UPC/JPA+DAO+Guidelines

[16:25:51 CDT(-0500)] <Naenyn> =] already got that open.

[16:26:35 CDT(-0500)] <Naenyn> it's the wiring up part I was missing.. the spring config stuff.

[16:26:38 CDT(-0500)] * Naenyn will read.

[16:29:20 CDT(-0500)] <EricDalquist> so the important bits are:

[16:29:20 CDT(-0500)] <EricDalquist> LocalContainerEntityManagerFactoryBean - sets up / exposes the JPA springified EntityManagerFactory

[16:29:20 CDT(-0500)] <EricDalquist> org.springframework.orm.jpa.JpaTransactionManager - Sets up the JPA backed transaction manager

[16:29:20 CDT(-0500)] <EricDalquist> <tx:annotation-driven/> - @Transactional support

[16:29:20 CDT(-0500)] <EricDalquist> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor - @PersistenceContext support

[16:29:23 CDT(-0500)] <EricDalquist> I think that is everything

[16:29:51 CDT(-0500)] <EricDalquist> in uPortal's persistenceContext.xml (if you are looking at master) org.jasig.portal.jpa.EventingLocalContainerEntityManagerFactoryBean is a custom extension of LocalContainerEntityManagerFactoryBean

[16:30:46 CDT(-0500)] <Naenyn> think I'm mostly following

[16:31:12 CDT(-0500)] <Naenyn> need to finish up my entity annotations and the dao...

[16:31:56 CDT(-0500)] <EricDalquist> The other thing to look at is org.jasig.portal.test.BaseJpaDaoTest

[16:32:12 CDT(-0500)] <EricDalquist> we use that to enable running unit tests for the JPA daos

[16:32:19 CDT(-0500)] <EricDalquist> you can then round-trip objects

[16:32:41 CDT(-0500)] <EricDalquist> look at JpaPortletCookieDaoImplTest for a concrete impl of that test case

[16:33:07 CDT(-0500)] <Naenyn> nice, will check that out.

[16:33:41 CDT(-0500)] <athena> sadly i don't think we have any portlets that actually use JPA

[16:33:48 CDT(-0500)] <athena> some refactoring required, someday (smile)

[16:34:16 CDT(-0500)] <EricDalquist> yeah

[16:34:32 CDT(-0500)] <EricDalquist> also wish we had time to move all this support stuff into submodules

[16:34:35 CDT(-0500)] <EricDalquist> so that other projects could use it

[16:34:45 CDT(-0500)] <athena> yeah

[16:35:44 CDT(-0500)] <dmccallum54> fffft

[16:36:16 CDT(-0500)] <dmccallum54> woops

[16:36:27 CDT(-0500)] <EricDalquist> lol

[16:36:29 CDT(-0500)] * dmccallum54 will type into the correct window next time

[16:36:29 CDT(-0500)] <athena> lol

[16:36:48 CDT(-0500)] <EricDalquist> preserved in the wiki logs for all eternity (wink)

[16:36:51 CDT(-0500)] <athena> lol

[16:37:13 CDT(-0500)] <athena> i know dmccallum54 totally just doesn't want us to factor out common tools

[16:37:25 CDT(-0500)] <athena> that's just how he rolls.

[16:38:41 CDT(-0500)] <EricDalquist> lol

[16:39:23 CDT(-0500)] * dmccallum54 sets about adding a link to today's IRC log to his resume...

[16:39:35 CDT(-0500)] <Naenyn> =D

[16:39:40 CDT(-0500)] <athena> we'll make sure it's your first google hit

[16:40:06 CDT(-0500)] <dmccallum54> athena ever helpful as always

[16:40:41 CDT(-0500)] <athena> i do try

[16:40:45 CDT(-0500)] * athena bows