Hibernate Error: "embeddableClass" is null

Asked on February 14, 2023
Look into my code.
@Entity
@Table(name="person")
public class Person {
@Id
@Column(name = "person_id")
private int id;
@EmbeddedId
private NameId nameId;
------
}
I started to use @EmbeddedId and getting error.
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.concretepage.Main.main(Main.java:13)
Caused by: java.lang.NullPointerException: Cannot invoke "org.hibernate.annotations.common.reflection.XClass.getAnnotation(java.lang.Class)" because "embeddableClass" is null
at org.hibernate.cfg.annotations.PropertyBinder.resolveCustomInstantiator(PropertyBinder.java:299)
at org.hibernate.cfg.annotations.PropertyBinder.bind(PropertyBinder.java:249)
at org.hibernate.cfg.annotations.PropertyBinder.makePropertyAndBind(PropertyBinder.java:224)
at org.hibernate.cfg.AnnotationBinder.bindComponent(AnnotationBinder.java:2010)
at org.hibernate.cfg.AnnotationBinder.bindBasic(AnnotationBinder.java:1402)
at org.hibernate.cfg.AnnotationBinder.buildProperty(AnnotationBinder.java:1251)

Replied on February 14, 2023
Only one id can be used. You should use either @Id or @EmbeddedId, not both. If you want to use @EmbeddedId, then delete @Id annotation.
You can check it from Jakarta doc.
"There must be only one EmbeddedId annotation and no Id annotation when the EmbeddedId annotation is used."
Reference:
https://jakarta.ee/specifications/persistence/3.0/apidocs/jakarta.persistence/jakarta/persistence/embeddedid

Replied on February 14, 2023
Thanks, got it.