Tapestry Training -- From The Source

Let me help you get your team up to speed in Tapestry ... fast. Visit howardlewisship.com for details on training, mentoring and support!

Saturday, March 03, 2007

T5 Spring Integration -- Hibernate next?

I've put together a first pass at Tapestry 5/Spring integration as another new module: tapestry-spring-integration.

It's small and to the point, leveraging the normal Spring configuration for web applications, just making beans available for injection into Tapestry components and services. Also, it makes accessing the Spring beans (from the Tapestry side) case insensitive.

Next up will be some form of Tapestry 5 / Hibernate integration ... however, due to the conflicting licenses, I may take a pass at tapestry-ejb3.

That licensing is driving me crazy; I've checked repeatedly with the Lords of Apache Licensing, and they maintain that the ASL is not compatible with the LGPL, that by linking to LGPL code (importing LGPL classes, in Java terms) the LGPL "infects" the ASL code, adding an unwanted restriction not present in ASL.

From the sidelines, it's funny and disturbing: The ASL folks talk about "fauxpen source licenses" as if openness was purely black and white, and the least restriction was a total betrayal. Meanwhile, the FSF camp keeps saying the licenses are compatible. Go figure.

I've had discussions with people who really got heated over ASL vs. LGPL. Andrew Oliver, for one, really tried to sell me on the idea that the ASL was a boon for corporations over individuals. From my position, the theoretical taking of "Tapestry" over by, say, IBM and rebranding it as "IBM Web Presentation Objects" (or something) would be laughable ... and even if it did happen, I think it would still be good for Tapestry, which is good for me, and good for the Tapestry community. True open source forks are really rare and look more like a straw man argument than a real consideration.

19 comments:

flamefew said...

I've never heard the term 'fauxpen' before, the issue over linking is not an issue now (Roller depends on Hibernate) and the issue is that we cannot distribute an LGPL work because that license makes the greater work significantly more binding than the Apache license.

Lastly I didn't know the FSF were saying the Apache license was compatible, last I heard they considered neither 1.1 nor 2.0 compatible.

Howard said...

It was from a comment by Noel Bergman last time I brought up Hibernate. I'll have to dig up the reference where the FSF claims ASL is compatible with LGPL.

I've just been working through Cliff's notes based on more recent board discussions, so it looks like the Hibernate issue is ok. I don't intend to ship Tapestry with dependencies in any case, and I believe the primary mechanism will be via Maven, with traditional binary and source distributions as a backup. So if I'm interpreting things correctly, I can build a bridge module that makes use of Hibernate code, I just have to alert users to that and make them go get the Hibernate libraries themselves. I think everyone can live with that.

Henri said...

Cliff's line in the sand is that a dependency is okay from the ASF point of view if it can be considered a part of the environment regardless of license.

So a Hibernate JSP Taglib is fine, cept that we can't distribute Hibernate itself. I think a Tapestry/Hibernate module is another one that is obviously made for an environment.

Roller's is less an environmental thing so I think that's dancing on the edge of the grey line. They've been looking at JPA for a while.

Maven's an interesting one. Can we consider the Maven central repository to be the expected environment - ergo anything in the Maven central repo is fine to use (if not distribute from somewhere other than the Maven repo).

Mihaela said...

Huge 1+ for *plugable* mechanism for working with "persistence context" libraries like Hibernate or JPA. I wouldn't suggest some strickly Hibernate support since a lot of people are for example using Spring for transaction demarcation for Hibernate or maybe JPA layer over Hibernate...
I dunno if this is so easy task for designing it properly since plain request interceptor that would wrap Tapestry HTTP request inside persistence transaction would only constitute session-per-request mechanism which already suffers from known problems. It would be best to have some session-per-conversation support.
Seam is the strongest in this area, and it defines few hierarchical levels of persistence contexts (Hibernate sessions) where some domain object could reside. I guess Tapernate or Honeycomb developer should know a bit more about whole problem, but I think Seam's docs would be the place to start...

David said...

You said: "[I]t would [be] good for Tapestry, which is good for me"

Can you explain what business model or thought processes you have to determine what is 'good' and 'bad' for you?

I'm interested because I have developed a valuable software tool and several people have suggested I make it open source. But from a financial point of view it doesn't seem to make sense.

How have you managed to get it to work for you?

Thanks.

Borut BolĨina said...

What about Cayenne?

Howard said...

It's all a matter of scheduling priorities. Without Spring/Hibernate integration, Tapestry can't be considered full featured. Cayenne makes sense (as just OJB, pure EJB3, etc.) but it's a matter of finding time. Right now I'm burning through my savings getting T5 ready to roll (and ready to be taught), so for the moment, Cayenne, Portlet Support & etc. are optional extras.

james said...

I really prefer Apache Cayenne to Hibernate ... so as much as I agree with you about license politics part of me wishes the licensing problem had pushed you towards Cayenne!

Jesse Kuhnert said...

Hooray for Hibernate support! :)

Not to the detriment of the others, but if we're giving opinions on what's next my vote is for hibernate.

Ted said...

Same here! hibernate now, then Ajax!
A DatePicker component would be neat too, but I guess that will be after Ajax.

matt_payne said...

Can spring beings be autowired from a spring configuration? Or does this still require @Inject?

Can one put spring aop advise on a tapestry action?

Howard said...

Matt:

No the integration is very, very primitive. Auto-wiring is tricky, but may be doable. AOP is pretty unlikely: there's a turf battle between Tapestry's class loaders (including the one it builds to load and transform component classes) and Spring's. It's not impossible, but it's getting there.

Andrus said...

Don't overlook that Cayenne is now "Cayenne Classic" + "Cayenne JPA" (JPA is persistence part of EJB3). We'll be glad to help with integration issues, if somebody takes a lead on the Tapestry end.

Ed said...

What about just using the JPA interface. Then a user could plug in hibernate, toplink, openJPA or what ever.

Of course, then you have to deal with Sun which could be worse

Howard said...

Framework guys like the "purity" of a specification / implementation split. Actual users, like to know that it works, and make fewer decisions. It's pretty clear that you will not be able to create a fully functional, high performance application using just the JPA specification, you will always need to drop down to implementation specific extensions. So, the plan is to create a "spike" with Hibernate, then generalize the approach, to create a template for supporting the many alternatives.

satyanarayana said...

Hi my name is satyanarayana. I am a developer in vision catalyst,india.
I am working on a project with the combination of tapestry, hibernate and springs. I am finding difficulty to get examples on components like checkbox in tapestry using hibernate for database.

Please help me in this regard
Thanks
satya

satyanarayana said...

This is one wonderful blog i got after lot of search, where i am finding lot of support in terms of using hibernate.
I am looking for examples on all component with the combination of spring and hibernate (checkbox, tree, tables).Please provide information on this
thanks

Stef said...

Hi,

Just to let you know that T5 just rocks.

I started developing on it 2 days ago and I just can work without it now.

I just have one question regarding T5 and Google maps application.

I have a simple service provider that returns addresses translated as GeoPoint with the help of geocoder. But, how to mix that in T5 page to have it rendered ?
I just have the map and nothing else...

thx

Olivier said...

It seems that you have gone forward and implemented a first hibernate library. What I would just love now is a new screencast demonstrating a simple CRUD application with this library! Or if it isn't a screencast it can be an addition to the tutorial. Or if it isn't that, just make code available and I'll turn it into a tutorial once I figure it out....