This looks totally amazing! Would you say CFGroovy is at a stable, production level yet? What are you planning to do with the next version?
I've read about GORM in Grails. It was meant to provide an easier API than Hibernate's, right? Since CFGroovy does not have a GORM-like layer, would dealing with Hibernate directly be a nightmare? This is the first time I saw that ColdSpring configuration. Maybe it deserves to be on an entry of your blog? So under what situation is JEE and whole java stack is required? How come the guys at Broadchoice didn't use CFGroovy instead? This is eye-opening to say the least!!! Henry Ho On Wed, Feb 11, 2009 at 12:10 PM, Barney Boisvert <[email protected]>wrote: > > Neither Spring nor Grails requires JEE either, only a web container > (what CF/Railo runs in). If you use CFGroovy, it provides the same > sort of wrapping of Hibernate that Spring provides, though it's not as > full featured. If you need some of the more esoteric functionality > you'll have to roll your own to some extent, but for the "mainstream" > use cases it's all really simple. I've put some ColdSpring conf for > setting up CFGroovy with Hibernate support and a transaction aspect > for proxying your services with at the bottom of the email, along with > a sample entity POGO. Very Spring-like, very simple. > > You can certainly write custom SQL code either via Hibernate or just a > normal CFQUERY tag against the database directly. CFGroovy uses a > standard DSN for it's connection source, so you can use the same DSN > in CFQUERY and do whatever you need. You also have access to the full > Hibernate query mechanisms, so you can go at it that way as well. You > obviously can't use CFQUERY (or any CF tags) inside a POGO, but you > can use the @Formula annotation if you need a dynamically computed > property that you'd rather express in SQL instead of with Groovy code. > If you're willing to break a little encapsulation, you can access the > Hibernate session from inside your POGO to run arbitrary queries that > way, but I'd strongly recommend against it. If you want to do that, > you probably have an architectural/design issue to address. > > cheers, > barneyb > > Here's the promised ColdSpring config: > > <bean id="cfgroovy" class="cfgroovy.cfgroovy" init-method="configure"> > <property name="path"> > <value>${groovyPath}</value> > </property> > <property name="plugins"> > <list> > <ref bean="cfhibernate" /> > </list> > </property> > </bean> > > <bean id="cfhibernate" class="cfgroovy.HibernatePlugin"> > <property name="entityPath"> > <value>${entityPath}</value> > </property> > <property name="coldFusionDsn"> > <value>${datasource}</value> > </property> > <property name="annotatedClasses"> > <list> > <value>Author</value> > <value>Category</value> > <value>Comment</value> > <value>Entry</value> > </list> > </property> > </bean> > > <bean id="transactionAdvice" > class="cfgroovy.hibernatetransactionadvice"> > <property name="cfhibernate"> > <ref bean="cfhibernate" /> > </property> > </bean> > > And the sample entity POGO: > > import javax.persistence.* > import org.hibernate.annotations.* > > @Entity > class Entry extends AbstractEntity { > > String title > String body > > @ManyToOne > Author author > > @OneToMany(mappedBy="entry") > @Sort(type=SortType.NATURAL) > SortedSet<Comment> comments > > @ManyToMany(mappedBy="entries") > @Sort(type=SortType.NATURAL) > SortedSet<Category> categories > > } > > On Wed, Feb 11, 2009 at 12:00 PM, Henry Ho <[email protected]> wrote: > > Oh, right... > > > > Hibernate+Groovy, w/ CFGroovy, CF8 Standard is okay. > > > > It is Spring (& Grails I suppose) that requires JEE server, right? > > > > I thought Spring, in some way, makes Hibernate easy. If I use Groovy > > directly with Hibernate using CFGroovy, what sort of difficulties will I > > face by using it directly without Spring? > > > > I guess if I choose that route, I'll write the beans as POGO, use > annotation > > for Hibernate, right? What if I need to write some custom SQL code? I > > can't use CFQuery in POGO right? > > > > > > Thanks, > > Henry Ho > > > > > > -- > Barney Boisvert > [email protected] > http://www.barneyb.com/ > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CFCDev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cfcdev?hl=en -~----------~----~----~----~------~----~------~--~---
