So, I understand the question seems a little odd and it probably is but to clarify:
@Entity
@Table(name = "OUTTER")
class Outter(){
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "outterId")
var id: Long? = null
@ElementCollection
val listOfInner = mutableListOf<Inner>()
}
@Embeddable
@Table(name = "INNER")
data class Inner(
@Id
@JoinColumn(name = "outterId")
var outter: Outter
)
doesn't work and I'm not sure why. It seems to follow the guides I've seen so not sure what I'm missing.
OUTTER:
outterId | outterStuff
---------------------
1 | info
INNER:
outterId | innerIndex | innerStuff
--------------------------------
1 | 0 | innerInfo
so it's 1 to multiple but the primary key for inner is outterId and then it uses other keys to make sure that it is unique (not an embedded ID tho)