2

I'm trying to figure out how to share domain and service classes between a Grails and Griffon projects.

Since this at a 'bird's eye view'/planning stage, I'm wondering if creating a standalone pojo library project would be a good approach for this. Then if I need to, reuse the same lib in an Androind project as well.

Or is it asking for a bit much in this context?

Edit 8/29/12 Just found out that a POJO with Hibernate annotations seems to work out of the box on Android. As in Hibernate annotations not causing any issues at this point. That was one of big concerns for me. So I had the domain model build out as much as possible, tested it in a swing app (no Griffon yet), Grails and all's well.

vector
  • 7,334
  • 8
  • 52
  • 80

1 Answers1

2

If said domain classes are real POJOs (no GORM attached) then it should work, particularly on Android as that platform has stricter restrictions.

It's possible to have GORM domain classes in Griffon, by leveraging standalone GORM, however that will fail in Android right away. Also, standalone GORM can be quite heavy in the number of dependencies added to the Griffon application.

Andres Almiray
  • 3,236
  • 18
  • 28
  • ... as I'm turning it over in my head, straight up POJOS in a lib, then extended in Grail, same for Grifon, etc. – vector Apr 22 '12 at 18:32
  • Right, this should works as long as the common lib is written in Java and has no deps to either framework (this way you can reuse the code in Android). – Andres Almiray Apr 23 '12 at 08:29
  • ... running into mapping issues on Grails side with a hasOne mapping though :-( – vector Apr 24 '12 at 12:59