`
yuanyao
  • 浏览: 147168 次
  • 性别: Icon_minigender_1
  • 来自: 就那小山沟
社区版块
存档分类
最新评论

org.hibernate.MappingException

阅读更多
%%%% Error Creating SessionFactory %%%%
org.hibernate.MappingException: could not instantiate id generator
        at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:98)
++++++++++++++++++=
        at org.hibernate.mapping.SimpleValue.createIde
ntifierGenerator(SimpleValue.java:152)
        at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:192)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
        at org.acm.maps.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:24)
        at org.acm.daoImpl.ClassesDaoImpl.getClasses(ClassesDaoImpl.java:24)
        at org.acm.struts.action.Test1.main(Test1.java:24)
Caused by: org.hibernate.MappingException: Dialect does not support sequences
        at org.hibernate.dialect.Dialect.getSequenceNextValString(Dialect.java:596)
        at org.hibernate.id.SequenceGenerator.configure(SequenceGenerator.java:65)
        at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:94)
        ... 6 more


xxx.hbm.xml代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
  <class name="org.acm.domain.Classes" table="classes">
    <id column="id" name="id" type="integer">
      <generator class="sequence">
        <param name="sequence">classs_id_seq</param>
      </generator>
    </id>
    <property column="grade" name="grade" type="string" unique="true"/>
    <property column="class" name="cla" type="string" unique="true" />
  </class>
</hibernate-mapping>


ubuntu8.04下,PostgreSql8.3 + hibernate3出现这个异常

解决办法:

把xxx.hbm.xml文件里的<generator class="sequence">改成<generator class="native">,问题解决.成功从数据库里读取数据.


让Hibernate自己去找采用的主键生成方式.


虽然问题已解决,但是对这个问题的理解还是很模糊,请各位指教.


ps:问题解决了,都不好意思说,我的数据库方言配置出错了,我晕
分享到:
评论

相关推荐

    hibernate错误解决方案

    nested exception is org.hibernate.MappingException: Repeated column in mapping for entity: com.xindeco.myregister.pojo.MyRegisterInfo column: password (should be mapped with insert="false" update=...

    Hibernate配置常见错误

    错误表现:尝试操作某个实体类时,出现“org.hibernate.MappingException: Unknown entity”错误,这意味着Hibernate并未识别到该实体类。 解决方案:确保实体类已添加@Entity注解,并且该类所在的包已被配置在...

    hibernate常见异常

    本文将介绍 Hibernate 中的一些常见异常,包括 net.sf.hibernate.MappingException、net.sf.hibernate.PropertyNotFoundException、org.hibernate.id.IdentifierGenerationException 以及 a different object with ...

    Spring3.1 集成 JBPM4.4

    NULL 博文链接:https://guoyinjian.iteye.com/blog/1259538

    JPA 开发中遇到的错误

    org.hibernate.MappingException: Unable to find column with logical name 这表示Hibernate在构建映射时未能找到与实体属性相对应的数据库列。确保实体类中的属性名称与数据库表中的列名相匹配,或者使用`@...

    Hibernate映射导致的几个异常

    - **MappingException: Error reading resource**:这通常意味着Hibernate在读取映射文件或配置文件时遇到了问题,可能是文件不存在、路径错误或格式不正确。确保`hibernate.cfg.xml`文件的位置正确,内容无误。 -...

    hibernate常见问题及处理.doc

    4. `org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save():` 此异常意味着在尝试保存对象前,对象的主键没有被正确设置。通常,这是由于在映射...

    hibernate教程从入门到精通第篇共四篇PPT学习教案.pptx

    在使用Hibernate时,可能会遇到`org.hibernate.MappingException: Unknown entity`这样的异常,这通常是因为在配置文件(如Hibernate.cfg.xml)中未指定实体的映射文件。例如,如果实体类为`...

    最经典的hibernate教程_从入门到精通3(hbiernate学习)

    首先,让我们解决异常`org.hibernate.MappingException: Unknown entity: com.aptech.jb.entity.TblUser`。这个异常通常是因为Hibernate没有找到指定的实体映射文件。解决方法是在`Hibernate.cfg.xml`配置文件中添加...

    hibernate ppt

    首先,出现 `org.hibernate.MappingException: Unknown entity` 异常通常是因为 Hibernate 没有找到指定的实体映射文件。在本例中,错误提示说没有在 Hibernate.cfg.xml 文件中添加 `&lt;mapping&gt;` 元素来指明 `...

    eclipse反向差件

    - **异常示例**:`org.hibernate.MappingException: Could not configure overrides from file`。 - **解决方法**:这通常是由于生成的`hibernate.reveng.xml`文件格式不正确导致的。解决方法是修改该文件的头部...

    EmbeddableTypes

    ( org.hibernate.MappingException: Repeated column in mapping for entity:YOUR_ENTITY ),因为表databsae不能具有重复的列名。 JPA定义了@AttributeOverride批注来处理此senario。 @AttributeOverrides({ @...

    hibernate配置properties

    jdbcPros.setProperty("hibernate.connection.driver_class", "org.gjt.mm.mysql.Driver"); jdbcPros.setProperty("hibernate.connection.url", "jdbc:mysql://localhost:3306/your_db"); jdbcPros.setProperty(...

    JSP 开发SSH整合异常解决办法

    而nested exception "org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister"则直接指出了问题的根源,在于Hibernate无法找到或获取到用于...

    hibernate常见错误解决方案

    **MappingException: Error reading resource: hibernate/Hello_Bean.hbm.xml** **异常描述:** 此异常表示Hibernate在加载指定的映射文件时遇到了问题。 **解决方法:** - 检查映射文件路径是否正确。例如,确保...

    spring错误总结.txt

    在创建`sessionFactory` Bean时出现初始化失败,深层异常是`MappingException: could not instantiate id generator`。 **原因分析**: 这通常是因为Hibernate配置中的ID生成策略存在问题。 **解决方案**: 1. **...

Global site tag (gtag.js) - Google Analytics