Hibernate comment hql Error

Source: Internet
Author: User

@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

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.