`
34971819
  • 浏览: 4969 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论
文章列表
今天在进行entity注解方式配置时,总是报错说在数据库中找不到相应的表,并且显示找不到的表都加了下划线,例如UserInfo实体中,有属性userName,那么hibernate会去在数据中找 user_info表和其中user_name属性。 而我的数据库中实际是userInfo表和属性userName。 找了好久的原因,发现是配置hibernate时候配置了命名策略,默认的是ImprovedNamingStrategy类,该类实现了NamingStrategy接口,在查看起源码中发现,如果实体类名中非首字母为大写,会在该字母前添加下划线,并在最后进行toLowerCase()操作。这样就会 ...
最近在项目中用到hibernate注解方式进行entity的注解,用到缓存的配置方式,其中有几个写法,给自己做个记录。 @Entity  @Cache(usage=CacheConcurrencyStrategy.READ_ONLY)   如果使用使用hibernate annoation是使用@Cache(usage=CacheConcurrencyStrategy.)标签,有5种可选的缓存方案:   1,CacheConcurrencyStrategy.NONE   不适用,默认   2.  CacheConcurrencyStrategy.NONSTRICT_READ_WRITE ...
我用jsf+spring+hibernate做了一个登录 老是提示 Hibernate operation: could not execute query; bad SQL grammar [select account0_.accountid as accountid, account0_.username as username0_, account0_.password as password0_ from login.account account0_ where account0_.username=? and account0_.password=?]; nested except ...
Global site tag (gtag.js) - Google Analytics