Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EQNA6DJ9VgCtW6zhCE8Xud
40 lines
912 B
Java
Executable File
40 lines
912 B
Java
Executable File
package com.ankurm.hibernatedemo.mappingstyle;
|
|
|
|
import jakarta.persistence.Column;
|
|
import jakarta.persistence.Entity;
|
|
import jakarta.persistence.GeneratedValue;
|
|
import jakarta.persistence.Id;
|
|
|
|
/**
|
|
* Annotated with {@code @Column(name = "annotation_name")}. A matching orm.xml entry
|
|
* (see {@code orm-xml-override-mapping.xml}) maps the SAME field to {@code xml_name} instead.
|
|
* Whichever name shows up in the generated DDL/SQL is the winner.
|
|
*
|
|
* <p>Docs: docs/04-annotations-vs-xml.md, Topic 1 (merge/override semantics).
|
|
*/
|
|
@Entity
|
|
public class OverrideEntity {
|
|
|
|
@Id
|
|
@GeneratedValue
|
|
private Long id;
|
|
|
|
@Column(name = "annotation_name")
|
|
private String value;
|
|
|
|
public OverrideEntity() {
|
|
}
|
|
|
|
public OverrideEntity(String value) {
|
|
this.value = value;
|
|
}
|
|
|
|
public Long getId() {
|
|
return id;
|
|
}
|
|
|
|
public String getValue() {
|
|
return value;
|
|
}
|
|
}
|