How can I configure the persistence.xml so that i don’t need to put all these @Column annotations into my entities to let the entitymanager use exactly the same case as the fieldname. By default all the fieldnames are uppercase when i look into the log file.
@Entity
@Table(name="INDICATE", schema="inet")
public class Indicate implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="indID", insertable = false, nullable=false, unique=true) private Long indID;
@Column(name="prditmNO") private String prditmNO;
@Column(name="indREASON") private Integer indREASON;
@Column(name="indIP") private String indTCPIP;
Thank you.
You can implement your own
org.hibernate.cfg.NamingStrategyfor that requirement in Hibernate. The easiest way would be to overrideorg.hibernate.cfg.ImprovedNamingStrategyand implement all methods that influence naming rules for tables and columns.Please keep in mind that there might be more methods that you want to override. See the JavaDocs for further documentation on this class.
Remember to register your custom
NamingStrategyimplementation in Hibernate. This can be done programatically when creating aSessionFactory.Alternatively you can use the declarative way to register a custom
NamingStrategysetting the propertyhibernate.ejb.naming_strategyto the full qualified class name of yourNamingStrategyimplementation like this: