JPA - convert object to sql query?

I am writing a JPA connector for an old system. The problem is that the design of the database in the system is ... well ... terrible.

I need to implement an object that maps to three tables. I can do it using named sql queries, but from the looks of it I have to use this object in relation to OneToMany (this object is on many sides). So how do I tell JPA to use a specific named query with a specific parameter?

And subquery: does any1 have good online JPA documentation? I can't find anything decent: - /

0


source to share


3 answers


I haven't really found a way to do this with JPA. To solve such problems, I ended up using a named query.

In terms of documentation, I am using TopLink and Hibernate .



If you find a better way, please post it here!

+1


source


Could you create a database view and then create an entity that displays that view? I don't know if this is possible, just a thought.



0


source


Take a look at @SecondaryTable (s). See Pro EJB 3 Java Peristance API , page 237 for some examples of this .

0


source







All Articles