1

I'm new to Spring jpa and have a usecase where I need to create:

Table A : With Columns 'a' , 'b' and 'c'

And Table B : With Columns 'd' and also columns which are there in Table A .

My question is ,

Can I annotate the POJO for Table A both with @Entity and @Embeddable ?

1 Answer 1

1

You will have to put two annotation by name @Embeddable and @MappedSuperclass on above the table A entity and also you will have to inherit table A entity into the table B entity like below.

@Embeddable
@MappedSuperclass
@Entity
class TableA{....}

@Entity
Class TableB extends TableA{...}
Sign up to request clarification or add additional context in comments.

Comments

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.