orm - JPA data relationships and JSON deserialization -


i've built application backend using spring-data-jpa on top of mysql , exposing these repositories world using jackson (json) , custom services.

slightly simplified, datamodel consists of of merchants, transactions , customers , associations between them. in database transaction has merchant_id , customer_id.

i don't want send complete copy of merchant each record, reads have exposed id's using jackson's concept of views:

@jsonview(views.partner.class) @column(name = "merchant_id", insertable = false, updatable = false) private long merchantid;  @manytoone @joincolumn(name = "merchant_id") @jsonignore private merchant merchant; 

this not terribly elegant, , @ loss how replicate insert or update operations. 1 option have separate dtos , recreate relationships in application, amount of overhead eats benefit of using jpa in first place.

i realize hateoas, @ least in theory, should solve problem. however, seems me raises bar implementing clients. not appear viable in of use cases.

so how others solve serialization / deserialization issue ?


Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -