Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.6
    • Fix Version/s: 1.0.2
    • Component/s: Spring ORM
    • Labels:
      None
    • Number of attachments :
      3

      Description

      Add classes to the Spring framework (http:://www.springframedwork.org) so that Castor will be itegrated with Spring in a similar way as other object relational mapping tools currentyl offering Spring support (Hibernate, OJB, JDO, etc.).

      This should at least include ...

      a) a BeanFactory for JDOManager.
      b) a CastorTemplate class, allowing easy and fast creation of DAOs using Castor JDO.

      1. patch.20050520.txt
        230 kB
        Werner Guttmann
      2. patch.C1095.20060307.txt
        197 kB
        Werner Guttmann
      3. patch.txt
        24 kB
        Werner Guttmann

        Activity

        Hide
        Werner Guttmann added a comment -

        I've got more or less a LocalCastorFactoryBean class (implementing FactoryBean from the Spring core) ready that I will attach shortly.

        Having said that, would anybody be able to interpret the following stack trace:

        org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdoManager' defined in class path resource [app-config.xml]: Initialization of bean failed; nested exception is java.lang.UnsupportedClassVersionError: javax/transaction/Synchronization (Unsupported major.minor version 48.0)
        java.lang.UnsupportedClassVersionError: javax/transaction/Synchronization (Unsupported major.minor version 48.0)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:488)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:106)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:243)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:51)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:190)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:183)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:288)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)
        at org.springframework.orm.castor.LocalCastorFactoryBean.createJDOManager(LocalCastorFactoryBean.java:153)
        at org.springframework.orm.castor.LocalCastorFactoryBean.afterPropertiesSet(LocalCastorFactoryBean.java:137)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1114)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:349)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:257)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:223)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:271)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:319)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:80)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:56)
        at org.springframework.orm.castor.TestLocalCastorFactoryBean.setUp(TestLocalCastorFactoryBean.java:28)
        at junit.framework.TestCase.runBare(TestCase.java:125)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)

        Show
        Werner Guttmann added a comment - I've got more or less a LocalCastorFactoryBean class (implementing FactoryBean from the Spring core) ready that I will attach shortly. Having said that, would anybody be able to interpret the following stack trace: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdoManager' defined in class path resource [app-config.xml] : Initialization of bean failed; nested exception is java.lang.UnsupportedClassVersionError: javax/transaction/Synchronization (Unsupported major.minor version 48.0) java.lang.UnsupportedClassVersionError: javax/transaction/Synchronization (Unsupported major.minor version 48.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:488) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:106) at java.net.URLClassLoader.defineClass(URLClassLoader.java:243) at java.net.URLClassLoader.access$100(URLClassLoader.java:51) at java.net.URLClassLoader$1.run(URLClassLoader.java:190) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:183) at java.lang.ClassLoader.loadClass(ClassLoader.java:294) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:288) at java.lang.ClassLoader.loadClass(ClassLoader.java:250) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310) at org.springframework.orm.castor.LocalCastorFactoryBean.createJDOManager(LocalCastorFactoryBean.java:153) at org.springframework.orm.castor.LocalCastorFactoryBean.afterPropertiesSet(LocalCastorFactoryBean.java:137) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1114) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:349) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:257) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:271) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:319) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:80) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:56) at org.springframework.orm.castor.TestLocalCastorFactoryBean.setUp(TestLocalCastorFactoryBean.java:28) at junit.framework.TestCase.runBare(TestCase.java:125) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
        Hide
        Werner Guttmann added a comment -

        FWIW, the problem mentioend above is indded related to JVM issues. After switching to a 1.4.x JDK, the problem disappears silently ... . Which implies that I have a working LOcalCastorFactoryBean ready for review that can be configured and used from within a Spring application context. Quite nice ... .

        Show
        Werner Guttmann added a comment - FWIW, the problem mentioend above is indded related to JVM issues. After switching to a 1.4.x JDK, the problem disappears silently ... . Which implies that I have a working LOcalCastorFactoryBean ready for review that can be configured and used from within a Spring application context. Quite nice ... .
        Hide
        Werner Guttmann added a comment -

        Initial patch to 'showcase' a LocalCastorFactoryBean incl. JUnit test case and sample Spring config file.

        Show
        Werner Guttmann added a comment - Initial patch to 'showcase' a LocalCastorFactoryBean incl. JUnit test case and sample Spring config file.
        Hide
        Bruce Snyder added a comment -

        Pasted from an email thread between Werner and me:

        > PS Any views on the Castor - Spring integration yet ?

        The patch contains a LOT of tabs .

        I'm guessing that this patch was created against the Spring HEAD, correct?

        But seriously, here are some thoughts:

        1) Please stop putting the Intalio copyright on any newly written
        classes. If you wrote it, put your name in the copyright notice. As
        others as code, they should add their name to the copyright notice.
        Also make sure that the copyright year is correct. I see you've pasted
        1999 in all of the new classes. Also, the TestLocalCastorFactoryBean
        class has a SPARDAT copyright on it.

        This topic leads directly into the topics of the Intalio copyrights
        already in existence on the code and the exolab name in the code.
        Sooner or later, we need to get these two items worked out. I'll speak
        to my friend David Blevins about how he handled this with Intalio for
        OpenEJB. I'll get back to you with my results.

        2) Javadocs in CastorCallback reference a PersistenceManager object.
        This is from the JDO 2.0 APIs and shouldn't be referenced in our code.
        Replace this with the appropriate Castor classes (i.e. JDOManager).

        3) A more thorough set of tests are needed before this patch can be
        submitted to the Spring project. I believe that mocks would be a good
        route to take. I've used EasyMock quite a lot, maybe I can take a stab
        at writing these soon.

        BTW, great work, Werner. I'm very happy to see this integration happening.

        Show
        Bruce Snyder added a comment - Pasted from an email thread between Werner and me: > PS Any views on the Castor - Spring integration yet ? The patch contains a LOT of tabs . I'm guessing that this patch was created against the Spring HEAD, correct? But seriously, here are some thoughts: 1) Please stop putting the Intalio copyright on any newly written classes. If you wrote it, put your name in the copyright notice. As others as code, they should add their name to the copyright notice. Also make sure that the copyright year is correct. I see you've pasted 1999 in all of the new classes. Also, the TestLocalCastorFactoryBean class has a SPARDAT copyright on it. This topic leads directly into the topics of the Intalio copyrights already in existence on the code and the exolab name in the code. Sooner or later, we need to get these two items worked out. I'll speak to my friend David Blevins about how he handled this with Intalio for OpenEJB. I'll get back to you with my results. 2) Javadocs in CastorCallback reference a PersistenceManager object. This is from the JDO 2.0 APIs and shouldn't be referenced in our code. Replace this with the appropriate Castor classes (i.e. JDOManager). 3) A more thorough set of tests are needed before this patch can be submitted to the Spring project. I believe that mocks would be a good route to take. I've used EasyMock quite a lot, maybe I can take a stab at writing these soon. BTW, great work, Werner. I'm very happy to see this integration happening.
        Hide
        Werner Guttmann added a comment -

        Initial patch covering the complete Castor integration into Spring, incl. ...

        a) LocalCastorFactoryBean.
        b) CastorTemplate/CastorInterceptor.
        c) CastorTransactionManager.
        d) JUnit test cases, covering certain areas of the code (far from complete, though).

        and

        e) A sample Spring application context file.
        f) Sample entity class
        g) Sample DAO classes (highlighting various ways of using these new artefacts).
        h) Sample service implementatiosn (plus service interface, using programmatic and declarative transaction de,arcation).

        and

        a file that documents how things shoudl be used together (as a kind of tutorial).

        Show
        Werner Guttmann added a comment - Initial patch covering the complete Castor integration into Spring, incl. ... a) LocalCastorFactoryBean. b) CastorTemplate/CastorInterceptor. c) CastorTransactionManager. d) JUnit test cases, covering certain areas of the code (far from complete, though). and e) A sample Spring application context file. f) Sample entity class g) Sample DAO classes (highlighting various ways of using these new artefacts). h) Sample service implementatiosn (plus service interface, using programmatic and declarative transaction de,arcation). and a file that documents how things shoudl be used together (as a kind of tutorial).
        Hide
        Werner Guttmann added a comment -

        Updated patch, where I discarded various changes (part of the previous patch) that have made into the codebase since. All test cases but one complete sucessfully.

        To-dos:

        • Add tests that use a JtaTransactionManager (most likely using JOTM).
        Show
        Werner Guttmann added a comment - Updated patch, where I discarded various changes (part of the previous patch) that have made into the codebase since. All test cases but one complete sucessfully. To-dos: Add tests that use a JtaTransactionManager (most likely using JOTM).
        Hide
        Werner Guttmann added a comment -

        Eventually created a new SVN project named 'castor-spring' and moved all required code there. Added a Maven 2 with a complete set of dependencies. As such, no binaries are included in the SVN repository. I'll write up a few Confluence pages in the next few days.

        Show
        Werner Guttmann added a comment - Eventually created a new SVN project named 'castor-spring' and moved all required code there. Added a Maven 2 with a complete set of dependencies. As such, no binaries are included in the SVN repository. I'll write up a few Confluence pages in the next few days.
        Hide
        Werner Guttmann added a comment -

        Made first release candidate available .....

        Show
        Werner Guttmann added a comment - Made first release candidate available .....

          People

          • Assignee:
            Werner Guttmann
            Reporter:
            Werner Guttmann
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1 week, 3 days, 20 minutes
              1w 3d 20m
              Remaining:
              Time Spent - 4 days, 2 hours Remaining Estimate - 5 days, 22 hours, 20 minutes
              5d 22h 20m
              Logged:
              Time Spent - 4 days, 2 hours Remaining Estimate - 5 days, 22 hours, 20 minutes
              4d 2h