hibernate - Spring JPA - How to map an ID from another Table as a value when getting the Object -


i have 2 entities in database. entity has fk entity b via entity b's id.

entity a

long id

long b_id

entity b

long id

string name

when entity via controller method, want return name associated id in entity b entity has stored within it.

example:

entity - id = 1, b_id = 1

entity b - id = 1, name = "hello"

json return controller entity give {"id": 1,"name": "hello"}.

how spring jpa?


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -