yahoo / elide

Elide is a Java library that lets you stand up a GraphQL/JSON-API web service with minimal effort.

Home Page:https://elide.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Seeking insights on embedding elide in JVM languages without annotations support

Nitinrajyadav opened this issue · comments

Is it possible to use elide embedded where we can't modify entities with additional annotations or in languages having no support for entities; by generating required metadata in JSON or any other formats, and by providing some binding/wrapper.

I have an application that is build in Cold-fusion[A JVM language].
It used hibernate under the hood for Entity-management by generating the hb.xml to get around the annotations.

Is it possibilities to use elide in the same fashion to create a read-only API to start with; so far, I haven't figured out anything approachable.

Does the hb.xml file map JVM classes to tables in your database?

Yes.
The language runtime generates the JVM classes(byte code) and generates the mappings for hibernate in 'classname.hb.xml' file for each entity with required metadata for the hibernate.
I have access to hibernate's entity manager and the session factory, which is compatible with JPA.

I would probably make a set of non-JPA elide models to represent the entities you want to expose through Elide - and then create a custom DataStore that wraps the JpaDataStore. The custom store just needs to convert between the hibernate entities and the Elide entities and call the corresponding methods in the JpaDataStore.