Found some partial answers to the below scenario but require further clarification.
Have the following situation:
- domain classes written in java
- the domain classes are not mapped to a DB through hibernate
- the java classes are used by a java server which simply performs intensive computations before returning result to client as a serialized java class
What I would like to do:
create a grails application which could do the following:
- use the java domain classes as grails domain classes
- have the java domain classes mapped to DB by GORM
- be able to create the java domain class from the groovy domain class in order to be able to send it to the java server for processing and then receive the java class response and transform it to groovy class in order to store in DB with GORM mapping
- basically have a grails application handle the user interaction and manage the object persistence for the external java server that processes the java classes
From the following post (Using Java beans as Grails domain classes) I see that the java domain classes can be used in grails by simply defining constraints, but this is if the classes are mapped with hibernate. In my case I want the classes to be mapped by GORM.
Solution:
- i was thinking about writing an equivalent groovy domain model for the java domain model. This however seems like a lot of work and modification to the java class will have to be replicated in the groovy classes.
- then i would need to write function to create the java class from the groovy class in order to pass the java class to the java processing server, and vice versa.
All suggestions to implement the above scenario are welcome.
Thanks.
I haven't tried this, but from the documentation that you pointed to, it looks like you could: