Re: mkorm helper project
[email protected] Mon, 10 Jan 2011 17:39:46 +1000
| Newsgroups | gmane.comp.java.orm.simpleorm |
|---|---|
| Message-ID | <[email protected]> |
Hello Franck,
Initially I did not do something like doInSession because the awkward syntax of anonymous inner methods, and that at the end of the day the number of lines of code required is about the same.
But the belated upcoming syntax for closures/lambdas changes that.
There seems to be two parts to your proposal, some that is Spring related, and some that is independent. Not sure. Obviously, if you add Spring support, then it should go in a different .jar, with no SimpleOrm --> Spring dependency.
I'm not sure about the Spring transactions. Personally I prefer explicit code rather than implicit annotations, and the utility of being able to create a transaction only if one does not already exist seems marginal. Normally you should know your outer level is.
The whole destroy on exception business is messy. But hard to know what else to do -- in general the database can be in an unpredictable state, particularly if triggers are used.
I did note an issue in our clone method -- you can clone a dataset which has been partially flushed. That would be a mess to reconnect. Needs some thought.
Regards,
Anthony
At 10:20 PM 20/12/2010, you wrote:
>
>
>Hi,
>
>I have just released some code whose objective is to facilitate the use
>of Simpleorm within a project that uses Springframework.
>
>It provides Spring integration in the same way as Hibernate, ibatis,
>toplink, jdo or even jdbc in Spring.
>See <http://static.springsource.org/spring/docs/2.0.x/reference/orm.html>http://static.springsource.org/spring/docs/2.0.x/reference/orm.html
>
>Mainly, mkorm will provide a SormTemplate, that have a few methods, and
>mainly one that says :
>
>sormTemplate.execute(SormCallback callback)
>
>The SormTemplate will take care of creating a session, beginning the
>session, committing and closing the session.
>
>The callback object will implement a single method :
>
>doInSession(SSessionJdbc ses)
>
>For example :
>
>doInSession(SSessionJdbc ses) {
>ses.findOrCreate(mymeta, "key");
>ses.flush();
>}
>
>Benefits of the approach are :
>- integrates with Spring (especially with spring transaction managament)
>- less copy and paste code for session management in you data access
>layer
>- will translate exceptions into Spring DataAccessExceptions hierarchy
>(especially will try to translate JdbcException into meaningful
>exceptions). Notice that DataCcessException are runtime, just as in
>Simpleorm...
>- a special DataValidationException is provided, that can refer to
>SFieldMetas (for UI integration) and carry a rescue dataset (for UI
>recovery in case of exception in the DAO layer)
>
>The project sources and a jar can be found here :
>
><https://launchpad.net/mkorm>https://launchpad.net/mkorm
>
>For now, the project is mostly untested, but I'm working on integrating
>it in my main project, so I will test it in the next days. Javadocs
>should be ok, but there is almost no other doc for now (only one
>overview blueprint in Launchpad).
>
>Any comments are welcome !
>
>Franck
>
>
Spreadsheet Detective,
Southern Cross Software Queensland Pty Limited
54 Gerler Street, Bardon, Queensland 4065, Australia.
www.SpreadsheetDetective.com
"If the model seems correct only because the numbers look right,
then why build the model in the first place?"
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/SimpleORM/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/SimpleORM/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/