当前位置: 首页 > news >正文

wordpress只启用cdn沈阳网站关键词优化

wordpress只启用cdn,沈阳网站关键词优化,wordpress边栏小工具,东莞效果好的网站建设现在的情况是#xff0c;在MySQL中有db1和db2两个数据库。项目使用Hibernate#xff0c;可同时访问db1和db2#xff0c;默认数据库为db1。表table2在db2中。且table2的主键名为ids#xff0c;是自增长字段#xff08;Auto Increment#xff09;。 table2和ids的定义为在MySQL中有db1和db2两个数据库。项目使用Hibernate可同时访问db1和db2默认数据库为db1。表table2在db2中。且table2的主键名为ids是自增长字段Auto Increment。 table2和ids的定义为 Entity Table(name table2, schema db2) Cache(usage CacheConcurrencyStrategy.READ_WRITE) public class Table2 implements java.io.Serializable {private static final long serialVersionUID 48L;IdColumn(name ids)GeneratedValue(generator idGenerator, strategy GenerationType.IDENTITY)GenericGenerator(name idGenerator, strategy increment)private Integer ids; 当向table2中保存数据时会报错。原因是生成ids时系统会查询table2中ids的最大值。语句是 select max(ids) from table2 由于默认数据库是db1因此查询的是db1.table2表。但table2表实际上在db2中所以系统找不到该表从而报错。 这就需要在GenericGenerator中指定max查询语句的schema。通过检查错误信息发现对应代码在org.hibernate.id.IncrementGenerator.configure()方法中如下 public void configure(Type type, Properties params, Dialect dialect) throws MappingException {returnClass type.getReturnedClass();ObjectNameNormalizer normalizer ( ObjectNameNormalizer ) params.get( PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER );String column params.getProperty( column );if ( column null ) {column params.getProperty( PersistentIdentifierGenerator.PK );}column dialect.quote( normalizer.normalizeIdentifierQuoting( column ) );String tableList params.getProperty( tables );if ( tableList null ) {tableList params.getProperty( PersistentIdentifierGenerator.TABLES );}String[] tables StringHelper.split( , , tableList );final String schema dialect.quote(normalizer.normalizeIdentifierQuoting(params.getProperty( PersistentIdentifierGenerator.SCHEMA )));final String catalog dialect.quote(normalizer.normalizeIdentifierQuoting(params.getProperty( PersistentIdentifierGenerator.CATALOG )));StringBuilder buf new StringBuilder();for ( int i0; i tables.length; i ) {final String tableName dialect.quote( normalizer.normalizeIdentifierQuoting( tables[i] ) );if ( tables.length 1 ) {buf.append( select max( ).append( column ).append( ) as mx from );}buf.append( Table.qualify( catalog, schema, tableName ) );if ( i tables.length-1 ) {buf.append( union );}}if ( tables.length 1 ) {buf.insert( 0, ( ).append( ) ids_ );column ids_.mx;}sql select max( column ) from buf.toString();} 在初始化Table2实体类时该方法就会执行。作用是生成对应数据库的select max语句。 在IncrementGenerator的注释中有一段话 Mapping parameters supported, but not usually needed: tables, column. (The tables parameter specified a comma-separated list of table names.) 说明在GenericGenerator中可以设置参数。在IncrementGenerator.configure()方法中可以将这些参数读出来。读取参数的方法为params.getProperty(参数名)。例如 params.getProperty( column ) 就是读取column参数的值。对应读取schema的语句为 final String schema dialect.quote(normalizer.normalizeIdentifierQuoting(params.getProperty( PersistentIdentifierGenerator.SCHEMA )) ); schema的参数名就是PersistentIdentifierGenerator.SCHEMA也就是schema。其他预置保留参数的值大都在org.hibernate.id.PersistentIdentifierGenerator中定义。如 public interface PersistentIdentifierGenerator extends IdentifierGenerator {/*** The configuration parameter holding the schema name*/public static final String SCHEMA schema;/*** The configuration parameter holding the table name for the* generated id*/public static final String TABLE target_table;/*** The configuration parameter holding the table names for all* tables for which the id must be unique*/public static final String TABLES identity_tables;/*** The configuration parameter holding the primary key column* name of the generated id*/public static final String PK target_column;/*** The configuration parameter holding the catalog name*/public static final String CATALOG catalog;/*** The key under whcih to find the {link org.hibernate.cfg.ObjectNameNormalizer} in the config param map.*/public static final String IDENTIFIER_NORMALIZER identifier_normalizer; 在GenericGenerator中设置parameter的方法为 Id Column(name ids) GeneratedValue(generator idGenerator, strategy GenerationType.IDENTITY) GenericGenerator(name idGenerator, strategy increment, parameters Parameter(name PersistentIdentifierGenerator.SCHEMA, value db2)) private Integer ids; 这样就能在table2前加上正确的schema名称db2生成正确的查询语句 select max(ids) from db2.table2 如果有多个参数可以写为 GenericGenerator(name idGenerator, strategy increment, parameters {             Parameter(name PersistentIdentifierGenerator.SCHEMA, value db2),             Parameter(namePersistentIdentifierGenerator.CATALOG, value db2) })
http://www.dnsts.com.cn/news/110035.html

相关文章:

  • 做网站之前要先购买服务器吗文档生成器app
  • 网站网页设计有哪些高要区公路建设规划局网站
  • 学做家常菜的网站 知乎html5网站特效
  • 做地坪网站wordpress主题文章形式
  • 巴中微信开发 做网站网络营销品牌推广
  • 哪个网站上可以做代打长沙游戏推广
  • 加强网站建设和维护关于网站建设的合同协议
  • 网站迁移建设方案阿里巴巴1688大企业采购平台
  • 找人做彩票网站多少钱网站服务器租赁需要什么手续
  • ztouchs网站查询自己建设一个网站软件
  • 网站后台模板免费下载移动端购物网站建设
  • 一般做推广网站的客户需求仕什么北京游戏软件开发公司
  • 青海西宁网页网站制作自己建个网站需要什么
  • 西安网站建设报价方案简单免费自建网站
  • 网站设计优点深圳游戏公司
  • 网站备案期间做网页dede网站头部和底部不能调用
  • 电子商务网站设计与...网友wordpress
  • 专业做二手网站淮南高端网站建设
  • ru后缀的网站赚钱软件一天赚100元游戏无广告
  • 中国航空集团建设开发有限公司网站seo公司厦门
  • 做网站用html还是jspps网站页面设计教程
  • seo可以提升企业网站的互联网营销方式有哪些
  • 微信公众号怎么做微网站制作网页与网站
  • 怎么更改网站备案信息吗成都网站优化公司
  • 做海关授权的网站有什么网站可以赚钱
  • 网站建设和网络优化请示学网站建设难
  • 上线倒计时单页网站模板网页设计师属于什么部门
  • wordpress使用数据库江苏seo培训
  • 怀柔网站整站优化公司建公司网站流程
  • 网站建设部工作职能深圳做高端网站建设公司