@Entity (name= "icertinfo") HQL query when you need to write entry name value, otherwise it will be error icertinfo
<bean id= "DataSource" class= "Com.mchange.v2.c3p0.ComboPooledDataSource" ><!-- user name --><property name= "User" value= "${db_username}" /><!-- User Password -->< Property name= "Password" value= "${db_password}" /><property name= "DriverClass" Value= "${db_driver_class}" /><property name= "Jdbcurl" value= "${db_url}" /><!-- The maximum number of connections that are kept in the connection pool. Default value: 15 --><property name= "maxpoolsize" value= " /><!-- The minimum number of connections retained in the connection pool, by default: 3 --><property name= "Minpoolsize" value= "5" /><!-- Initialize the number of connections in the connection pool, the value should be between Minpoolsize and Maxpoolsize, the default is 3 --><property name= "Initialpoolsize" value= "2" /><!--c3p0 the number of connections fetched at a time when the connection in the connection pool is exhausted. Default value: 3 --><property name= "Acquireincrement" value= "2" /><!-- Defines the number of repeated attempts to obtain a new connection from the database after a failure. The default value: 30 ; less than or equal to 0 means infinite --><property name= "aCquireretryattempts " value=" 0 " /><!--retry interval, default: 1000 ms --><property name=" Acquireretrydelay " value=" /></bean><!-- Get hibernate sessionfactory --><bean id= "Sessionfactory" class= " Org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean "><property name=" DataSource "><ref bean=" DataSource " /></property><property name=" Hibernateproperties "><value>hibernate.dialect=org.hibernate.dialect.mysqldialecthibernate.show_sql= truehibernate.format_sql=truehibernate.hbm2ddl.auto=update</value></property><property Name= "Packagestoscan" ><list><value>com.itrus.business.model</value></list></ Property></bean>
Packagestoscan, configuration errors HQL will also error
Package com.itrus.business.properties;import java.util.hashmap;import java.util.map;import java.util.Properties;import org.springframework.beans.BeansException;import org.springframework.beans.factory.config.configurablelistablebeanfactory;import org.springframework.beans.factory.config.propertyplaceholderconfigurer;public class proinfo extends propertyplaceholderconfigurer {private static map<string, object> ctxpropertiesmap; @Override protected void processproperties ( configurablelistablebeanfactory beanfactory, properties props) throws beansexception { super.processproperties (Beanfactory, props); ctxpropertiesmap = new hashmap<string,&Nbsp;object> (); for (Object key : props.keyset ()) { string keystr = key.tostring (); string value = props.getproperty (KEYSTR); ctxpropertiesmap.put (KeyStr, value); } } public static object getcontextproperty (String name) { return ctxpropertiesmap.get (name); }}
Url=
#AccountHash =
Accounthash=
Password=password
fapiaotong=
Certpath=e\://test.cer
Db_username=root
#db_password =
db_password=
Db_driver_class=com.mysql.jdbc.driver
#db_url =jdbc\:mysql\://\:3306/hibernate?useunicode\=true&characterencoding\=utf-8
Db_url=jdbc\:mysql\://localhost\:3306/hibernate?useunicode\=true&characterencoding\=utf-8
<!--read configuration file--><bean id= "Proinfo" class= "Com.itrus.business.properties.ProInfo" ><property name= " Locations "><list><value>classpath:info.properties</value></list></property> </bean>
Do not configure package scan queries need to write full name Com.itrus.business.model.ICertInfo
Hibernate comment hql Error