« An example of plugga... | Main | Dot-Net love child »

Comments on Ag, DAO, and pluggable persistence?

Below is the email that I sent to the Hibernate and Castor mailing lists to ask for comments on Ag:

I've written a simple example application that shows how to create a simple web application (a newsfeed aggregator) with a pluggable persistence layer. I used the tried and true DAO pattern to hide the database access mechanism from the rest of the application. I implemented the DAO interface with both Hibernate and Castor.

I did this to learn:
  • What are the drawbacks of hiding powerful persistence engine behind a simple DAO interface. What do you loose? Will long transaction support work? What about lazy loading?
  • What are the differences between and strenghts/weaknesses of Castor and Hibernate?
  • What is the best way to implement DAO with each of the tools?

The code is very simple and (I hope) easy to follow, so if you have a chance please take a look. Look at the HibeAggregatorDAO and CastorAggregatorDAO implementations to see how I used Hiberate and Castor to implement the very same DAO. I'd love to get your opinions on the above topics.

Ag Download: http://sourceforge.net/project/shownotes.php?release_id=125110
Ag Readme: http://sourceforge.net/project/showfiles.php?group_id=47722

Comments:

I was trying to download the ag.jar file from this SF url but the file doesn't appear to be there. Any idea on how I can download this file? Thanks!!

Posted by Kurt Wiersma on December 02, 2002 at 03:29 AM EST #

I had no problem downloading from the URL and it looks like about 20 other people have had success as well. Could it be a temporary SF problem?

Posted by Dave Johnson on December 02, 2002 at 04:42 PM EST #

thanks for your cool hiberate example.:) It seems something wrong,working with jdk1.4.1. buid error msg: ------------------------------------------------- D:\devhome\Tomcat 4.1\webapps\ch10>build start-hsql D:\devhome\Tomcat 4.1\webapps\ch10>REM java -Djava.home=d:\devhome\j2sdk1.4.1 -D ant.home=d:\devhome\jakarta-ant-1.5 -classpath d:\devhome\j2sdk1.4.1\lib\tools.j ar;d:\devhome\jakarta-ant-1.5\lib\ant.jar;d:\devhome\jakarta-ant-1.5\lib\optiona l.jar;d:\devhome\jakarta-ant-1.5\lib\xercesImpl.jar;d:\devhome\jakarta-ant-1.5\l ib\xml-apis.jar org.apache.tools.ant.Main start-hsql D:\devhome\Tomcat 4.1\webapps\ch10>java -Dant.home=d:\devhome\jakarta-ant-1.5 -c lasspath d:\devhome\j2sdk1.4.1\lib\tools.jar;d:\devhome\jakarta-ant-1.5\lib\ant. jar;d:\devhome\jakarta-ant-1.5\lib\optional.jar;d:\devhome\jakarta-ant-1.5\lib\x ercesImpl.jar;d:\devhome\jakarta-ant-1.5\lib\xml-apis.jar org.apache.tools.ant.M ain start-hsql Buildfile: build.xml BUILD FAILED java.lang.UnsupportedClassVersionError: com/sun/javadoc/Doc (Unsupported major.m inor version 48.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at org.apache.tools.ant.AntClassLoader.findBaseClass(AntClassLoader.java :1102) at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:919 ) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.getConstructor0(Native Method) at java.lang.Class.getConstructor(Unknown Source) at org.apache.tools.ant.IntrospectionHelper.<init>(IntrospectionHelper.j ava:328) at org.apache.tools.ant.IntrospectionHelper.getHelper(IntrospectionHelpe r.java:384) at org.apache.tools.ant.helper.ProjectHelperImpl$NestedElementHandler.in it(ProjectHelperImpl.java:949) at org.apache.tools.ant.helper.ProjectHelperImpl$TaskHandler.startElemen t(ProjectHelperImpl.java:870) at org.apache.xerces.parsers.AbstractSAXParser.startElement(AbstractSAXP arser.java:415) at org.apache.xerces.impl.XMLNamespaceBinder.startElement(XMLNamespaceBi nder.java:571) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidat or.java:756) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElemen t(XMLDocumentFragmentScannerImpl.java:752) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent Dispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1453) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XM LDocumentFragmentScannerImpl.java:333) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.jav a:524) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.jav a:580) at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152) at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.j ava:1169) at org.apache.tools.ant.helper.ProjectHelperImpl.parse(ProjectHelperImpl .java:155) at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.jav a:117) at org.apache.tools.ant.Main.runBuild(Main.java:597) at org.apache.tools.ant.Main.start(Main.java:196) at org.apache.tools.ant.Main.main(Main.java:235) Total time: 8 seconds ....

Posted by Aaron Tang on January 01, 2003 at 02:39 AM EST #

thanks for your cool hiberate example.:) It seems something wrong,working with jdk1.4.1. buid error msg: ------------------------------------------------- D:\devhome\Tomcat 4.1\webapps\ch10>build start-hsql D:\devhome\Tomcat 4.1\webapps\ch10>REM java -Djava.home=d:\devhome\j2sdk1.4.1 -D ant.home=d:\devhome\jakarta-ant-1.5 -classpath d:\devhome\j2sdk1.4.1\lib\tools.j ar;d:\devhome\jakarta-ant-1.5\lib\ant.jar;d:\devhome\jakarta-ant-1.5\lib\optiona l.jar;d:\devhome\jakarta-ant-1.5\lib\xercesImpl.jar;d:\devhome\jakarta-ant-1.5\l ib\xml-apis.jar org.apache.tools.ant.Main start-hsql D:\devhome\Tomcat 4.1\webapps\ch10>java -Dant.home=d:\devhome\jakarta-ant-1.5 -c lasspath d:\devhome\j2sdk1.4.1\lib\tools.jar;d:\devhome\jakarta-ant-1.5\lib\ant. jar;d:\devhome\jakarta-ant-1.5\lib\optional.jar;d:\devhome\jakarta-ant-1.5\lib\x ercesImpl.jar;d:\devhome\jakarta-ant-1.5\lib\xml-apis.jar org.apache.tools.ant.M ain start-hsql Buildfile: build.xml BUILD FAILED java.lang.UnsupportedClassVersionError: com/sun/javadoc/Doc (Unsupported major.m inor version 48.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at org.apache.tools.ant.AntClassLoader.findBaseClass(AntClassLoader.java :1102) at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:919 ) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.getConstructor0(Native Method) at java.lang.Class.getConstructor(Unknown Source) at org.apache.tools.ant.IntrospectionHelper.<init>(IntrospectionHelper.j ava:328) at org.apache.tools.ant.IntrospectionHelper.getHelper(IntrospectionHelpe r.java:384) at org.apache.tools.ant.helper.ProjectHelperImpl$NestedElementHandler.in it(ProjectHelperImpl.java:949) at org.apache.tools.ant.helper.ProjectHelperImpl$TaskHandler.startElemen t(ProjectHelperImpl.java:870) at org.apache.xerces.parsers.AbstractSAXParser.startElement(AbstractSAXP arser.java:415) at org.apache.xerces.impl.XMLNamespaceBinder.startElement(XMLNamespaceBi nder.java:571) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidat or.java:756) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElemen t(XMLDocumentFragmentScannerImpl.java:752) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent Dispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1453) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XM LDocumentFragmentScannerImpl.java:333) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.jav a:524) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.jav a:580) at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152) at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.j ava:1169) at org.apache.tools.ant.helper.ProjectHelperImpl.parse(ProjectHelperImpl .java:155) at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.jav a:117) at org.apache.tools.ant.Main.runBuild(Main.java:597) at org.apache.tools.ant.Main.start(Main.java:196) at org.apache.tools.ant.Main.main(Main.java:235) Total time: 8 seconds ....

Posted by Aaron Tang on January 01, 2003 at 04:12 AM EST #

When i use jdk1.4.1 & ant-1.5, errors above come up against me. but Exception's getCause() method only "since 1.4" could anybody help me out of such trouble? thanks a lot. And I really appriciate that anyone should email me a solution.

Posted by Aaron Tang on January 01, 2003 at 05:01 AM EST #

Post a Comment:
  • HTML Syntax: NOT allowed

« An example of plugga... | Main | Dot-Net love child »

Welcome

This is just one entry in the weblog Blogging Roller. You may want to visit the main page of the weblog

Related entries

Below are the most recent entries in the category Java, some may be related to this entry.