0

I have a database table that has a huge amount of columns. I want to access that table using different JPA Entities, so each entity should also represent a few columns of that table. Therefore I created two different @Entity classes which point to the same physical table using @Table(name ="personal") annotation. But this doesn't seem to work. As soos as I set the second Entity to the same table I get the following error whenever I try to work with those entities:

javax.persistence.Table.indexes()[Ljavax/persistence/Index; java.lang.NoSuchMethodError

So, this seems to be the wrong way.

What's the best way to deal with realy large tables if 90% of the columns are not of interrest ? Is it possible to create several JPA Entity classes for the same database table ?

thanks for any help! Thorsten

1 Answer 1

1

I would consider to create multiple views of that table and bind these views to entities.

Sign up to request clarification or add additional context in comments.

1 Comment

No in your database you create a view with only the columns you like and then you create an entity reflecting that view.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.