Hibernate, JPA mapping field issues [Improvednamingstrategy]

Source: Internet
Author: User
/**
 * <P>PROJECT:COM.MIDEA.JR.ECF			<p>
 * <p>module:meloans.utils			<p>
 * <p>description: Table column name turns to uppercase		<p>
 *
 * @author WANGZY25
 * @date September 20, 2016 PM 5:35:15
 * * Public
class Namingstrategy extends improvednamingstrategy{
	
	/**  */
	private static final long Serialversionuid = 1L;

	@Override public
	string TableName (String tableName) {
		return tablename.touppercase ();
	}
	
	@Override public
	string ColumnName (String columnName) {
		return Super.columnname (columnName). toUpperCase () ;
	}
	
	@Override public
	string Propertytocolumnname (String propertyname) {
		return super.propertytocolumnname ( PropertyName). toUpperCase ();
	}
}


Configuration in Entitymanagerfactory:

<prop key= "Hibernate.ejb.naming_strategy" >com.midea.jr.ecf.meloans.utils.NamingStrategy</prop>

<property name= "Jpaproperties" > <props> <prop key= "Hibernate.dialect" >${hibernate.dialect}</p rop> <prop key= "Hibernate.ejb.naming_strategy" >com.midea.jr.ecf.meloans.utils.namingstrategy</prop > <prop key= "Hibernate.cache.use_second_level_cache" >${hibernate.cache.use_second_level_cache}</prop
				> <prop key= "Hibernate.cache.region.factory_class" >${hibernate.cache.region.factory_class}</prop> <prop key= "Hibernate.cache.use_query_cache" >${hibernate.cache.use_query_cache}</prop> <prop key= " Hibernate.jdbc.fetch_size ">${hibernate.jdbc.fetch_size}</prop> <prop key=" Hibernate.jdbc.batch_size " >${hibernate.jdbc.batch_size}</prop> <prop key= "Hibernate.hbm2ddl.auto" >update</prop> &LT;PR  Op key= "Hibernate.show_sql" >true</prop> <prop key= "Hibernate.format_sql" >true</prop> <prop key= "Hibernate.use_sql_comments" &GT;FALSE&LT;/PROP&GT <prop key= "hibernate.connection.isolation" >2</prop> <prop key= "Javax.persistence.validation.mode" >none</prop> </props> </property>


Reference: Hibernate mapping field issues [Improvednamingstrategy]

http://blog.csdn.net/dracotianlong/article/details/27834143

Hibernate Create a naming policy

Http://www.cnblogs.com/wangyong/p/Hibernate.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.