Hi 希望这里能有人解决这个问题。谢谢了。
异常描述:
A. Caused by: org.hibernate.hql.ast.QuerySyntaxException: Customer is not mapped [select u from Customer u where u.username=:el1]
B.Caused by: org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping class="XX.XX.XXXX.XXX.model.Customer"/>
问题描述:
我使用Seam2.1.2整合JBPM(使用到业务流),流程定义已经引用到了components.xml,JBPM相关映射也已经写在了hibernate.cfg.xml,但是如果我不在hibernate.cfg.xml中映射我自己定义的Entity Bean Customer ,当我登陆时,异常A出现(用到了该bean),如果以<mapping class="XX.XX.XXXX.XXX.model.Customer"/>方式映射时,异常B出现。如果您知道,请告诉我比较详细的解决方案。

解决方案 »

  1.   

    这是hibernate的问题。
    如果想用JPA,就是你说的<mapping class="XX.XX.XXXX.XXX.model.Customer"/>,就要使用AnnotationConfiguration解析hibernate.cfg.xml。普通的Configuration只能解析<mapping resource="Customer.hbm.xml"/>这个就要问seam了,seam不支持JPA吗?
      

  2.   

    另外给我们自己做一下宣传:jBPM4免费视频教程:www.family168.com/jbpm4/video.html
      

  3.   

    你说的使用AnnotationConfiguration解析hibernate.cfg.xml 指的是在Eclipse中配置Hibernate时候那几个选择core> <annotation><JPA> ?还是其他的。对了在我写hibernate.cfg.xml 文件中,JBPM的相关映射是这么写的。 
         <mapping resource="org/jbpm/graph/def/ProcessDefinition.hbm.xml"/>
        <mapping resource="org/jbpm/graph/def/Node.hbm.xml"/>
        <mapping resource="org/jbpm/graph/def/Transition.hbm.xml"/>
        <mapping resource="org/jbpm/graph/def/Event.hbm.xml"/>
        <mapping resource="org/jbpm/graph/def/Action.hbm.xml"/>
        <mapping resource="org/jbpm/graph/def/SuperState.hbm.xml"/>
        <mapping resource="org/jbpm/graph/def/ExceptionHandler.hbm.xml"/>
        <mapping resource="org/jbpm/instantiation/Delegation.hbm.xml"/>
      

  4.   

    A. Caused by: org.hibernate.hql.ast.QuerySyntaxException: Customer is not mapped [select u from Customer u where u.username=:el1]           不是seam jbpm的问题吧,你看你的customer实体怎么映射的        还有你那句查询的  语法出错啊
      

  5.   

    在整合JBPM之前,他们都是好用的。=:el1这是EL表达式
      

  6.   

    问题已解决。原来他们有各自的Hibernate配置文件。而无法使用同一个。问题已经提交给Seam官方论坛。但愿在新的版本里能解决。