0

未定義である私のpom.xmlは次のとおりです。LocalVariableDeclarationStatement - メソッドaddAnnotatedClassは()型の構成のため

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>HibernateOneToOneMapping</groupId> 
    <artifactId>HibernateOneToOneMapping</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <build> 
     <sourceDirectory>src</sourceDirectory> 
     <plugins> 
      <plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.1</version> 
       <configuration> 
        <source>1.8</source> 
        <target>1.8</target> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
    <dependencies> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-validator</artifactId> 
      <version>5.0.2.Final</version> 
     </dependency> 

     <!-- http://mvnrepository.com/artifact/org.hibernate.javax.persistence/hibernate-jpa-2.1-api --> 
     <dependency> 
      <groupId>org.hibernate.javax.persistence</groupId> 
      <artifactId>hibernate-jpa-2.1-api</artifactId> 
      <version>1.0.0.Final</version> 
     </dependency> 


     <!-- http://mvnrepository.com/artifact/mysql/mysql-connector-java --> 
     <dependency> 
      <groupId>mysql</groupId> 
      <artifactId>mysql-connector-java</artifactId> 
      <version>5.1.6</version> 
     </dependency> 

     <!-- http://mvnrepository.com/artifact/org.hibernate/hibernate-annotations --> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-annotations</artifactId> 
      <version>3.5.6-Final</version> 
     </dependency> 
     <dependency> 
      <groupId>org.hibernate.common</groupId> 
      <artifactId>hibernate-commons-annotations</artifactId> 
      <version>4.0.4.Final</version> 
     </dependency> 
    </dependencies> 
</project> 

のセッションファクトリオブジェクトを作成します。

SessionFactory factory = new Configuration().configure().addAnnotatedClass(com.bean.Stock.class)   .addAnnotatedClass(com.bean.StockDetail.class).buildSessionFactory(); 

問題:

メソッド名addAnnotatedClassを org.hibernate.cfg.configurationクラスから解決できません。

+0

はない '' org.hibernate.cfg.configuration' org.hibernate.cfg.Configuration'、でなければなりません。さらにソースコードを表示する。 –

答えて

0

使用Mavenの依存関係以下:

<!-- http://mvnrepository.com/artifact/antlr/antlr --> <!-- http://mvnrepository.com/artifact/dom4j/dom4j --> <!-- http://mvnrepository.com/artifact/org.apache.geronimo.specs/geronimo-jta_1.1_spec --> <!-- http://mvnrepository.com/artifact/org.hibernate/hibernate-core --> <!-- http://mvnrepository.com/artifact/org.hibernate.common/hibernate-commons-annotations --> <!-- http://mvnrepository.com/artifact/org.hibernate.javax.persistence/hibernate-jpa-2.1-api --> <!-- http://mvnrepository.com/artifact/org.jboss/jandex --> <!-- http://mvnrepository.com/artifact/org.javassist/javassist --> <!-- http://mvnrepository.com/artifact/org.jboss.logging/jboss-logging --> <!-- http://mvnrepository.com/artifact/mysql/mysql-connector-java -->

関連する問題