2011-03-29 3 views
7

DB에 매핑 할 최대 절전 모드 주석이있는 DTO 파일을 컴파일하려고하면 이상한 문제가 발생합니다. 아래의 이상한 메시지 기록으로 실패 할 때. 이 문제의 원인은 무엇입니까? 파일 CashDTO에서 오류가 발생한다고 가정합니다. 파일 CashDTO.java에서 내가 뭘 잘못하고 있니?hibernate annotations 컴파일 오류

import java.io.Serializable; 
import java.math.BigDecimal; 
import java.util.Date; 

import javax.persistence.Column; 
import javax.persistence.Entity; 
import javax.persistence.FetchType; 
import javax.persistence.GeneratedValue; 
import javax.persistence.GenerationType; 
import javax.persistence.Id; 
import javax.persistence.JoinColumn; 
import javax.persistence.ManyToOne; 
import javax.persistence.Table; 
import javax.persistence.TableGenerator; 
import javax.persistence.Version; 
import org.hibernate.annotations.Cache; 
import org.hibernate.annotations.CacheConcurrencyStrategy; 

    /** 
    * @author othmanelmoulat 
    * 
    */ 
    @Entity 
    @TableGenerator(name = "cash_GEN", table = "jbilling_seqs", pkColumnName = "name", valueColumnName = "next_id", pkColumnValue = "cash", allocationSize = 100) 
    @Table(name = "cash") 
    public class CashDTO implements Serializable { 
     int id; 
     BigDecimal amount; 
     Date date; 
     int versionNum; 

     public CashDTO() { 
      super(); 
      // TODO Auto-generated constructor stub 
     } 

     public CashDTO(int id) { 
      super(); 
      this.id = id; 
     } 

     public CashDTO(int id, BigDecimal amount, Date date) { 
      super(); 
      this.id = id; 
      this.amount = amount; 
      this.date = date; 
     } 

     public CashDTO(int id, BigDecimal amount, Date date, int versionNum) { 
      super(); 
      this.id = id; 
      this.amount = amount; 
      this.date = date; 
      this.versionNum = versionNum; 
     } 

     @Id 
     @GeneratedValue(strategy = GenerationType.TABLE, generator = "cash_GEN") 
     @Column(name = "id", unique = true, nullable = false) 
     public int getId() { 
      return this.id; 
     } 

     public void setId(int id) { 
      this.id = id; 
     } 
     @Column(name = "amount", nullable = false) 
     public BigDecimal getAmount() { 
      return amount; 
     } 

     public void setAmount(BigDecimal amount) { 
      this.amount = amount; 
     } 
     @Column(name = "date", nullable = false) 
     public Date getDate() { 
      return date; 
     } 

     public void setDate(Date date) { 
      this.date = date; 
     } 
     @Version 
     @Column(name = "OPTLOCK") 
     public int getVersionNum() { 
      return versionNum; 
     } 

     public void setVersionNum(int versionNum) { 
      this.versionNum = versionNum; 
     } 

    } 

오류 로그 : javax.persistence에 대한 수업이 test-ws 개미 대상에서 javac 작업의 클래스 경로에없는 것처럼

Buildfile: /Users/othmanelmoulat/Documents/workspace/jbilling/src/build.xml 

init: 
    [delete] Deleting directory /Users/othmanelmoulat/Documents/workspace/jbilling/src/build/test-results 
    [mkdir] Created dir: /Users/othmanelmoulat/Documents/workspace/jbilling/src/build/test-results 

compile_api: 
    [javac] /Users/othmanelmoulat/Documents/workspace/jbilling/src/build.xml:272: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds 

findRevision: 

jar_api: 
     [jar] Building jar: /Users/othmanelmoulat/Documents/workspace/jbilling/src/build/deploy/jbilling_api.jar 

test-ws: 
    [javac] /Users/othmanelmoulat/Documents/workspace/jbilling/src/build.xml:457: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds 
    [javac] Compiling 7 source files to /Users/othmanelmoulat/Documents/workspace/jbilling/src/build/test 
    [javac] com/sapienter/jbilling/server/user/db/CashDTO.class(com/sapienter/jbilling/server/user/db:CashDTO.class): warning: Cannot find annotation method 'name()' in type 'javax.persistence.TableGenerator': class file for javax.persistence.TableGenerator not found 
    [javac] com/sapienter/jbilling/server/user/db/CashDTO.class(com/sapienter/jbilling/server/user/db:CashDTO.class): warning: Cannot find annotation method 'table()' in type 'javax.persistence.TableGenerator' 
    [javac] com/sapienter/jbilling/server/user/db/CashDTO.class(com/sapienter/jbilling/server/user/db:CashDTO.class): warning: Cannot find annotation method 'pkColumnName()' in type 'javax.persistence.TableGenerator' 
    [javac] com/sapienter/jbilling/server/user/db/CashDTO.class(com/sapienter/jbilling/server/user/db:CashDTO.class): warning: Cannot find annotation method 'valueColumnName()' in type 'javax.persistence.TableGenerator' 
    [javac] com/sapienter/jbilling/server/user/db/CashDTO.class(com/sapienter/jbilling/server/user/db:CashDTO.class): warning: Cannot find annotation method 'pkColumnValue()' in type 'javax.persistence.TableGenerator' 
    [javac] com/sapienter/jbilling/server/user/db/CashDTO.class(com/sapienter/jbilling/server/user/db:CashDTO.class): warning: Cannot find annotation method 'allocationSize()' in type 'javax.persistence.TableGenerator' 
    [javac] com/sapienter/jbilling/server/user/db/CashDTO.class(com/sapienter/jbilling/server/user/db:CashDTO.class): warning: Cannot find annotation method 'name()' in type 'javax.persistence.Table': class file for javax.persistence.Table not found 
    [javac] com/sapienter/jbilling/server/user/db/CashDTO.class(com/sapienter/jbilling/server/user/db:CashDTO.class): warning: Cannot find annotation method 'strategy()' in type 'javax.persistence.GeneratedValue': class file for javax.persistence.GeneratedValue not found 
    [javac] An exception has occurred in the compiler (1.6.0_24). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you. 
    [javac] com.sun.tools.javac.code.Symbol$CompletionFailure: class file for javax.persistence.GenerationType not found 

BUILD FAILED 
/Users/othmanelmoulat/Documents/workspace/jbilling/src/build.xml:457: Compile failed; see the compiler error output for details. 

Total time: 5 seconds 
+0

이것은 컴파일러의 버그로 인한 것입니다. - http://bugs.java.com/view_bug.do?bug_id=6550655 – fnt

답변

5

는 소리.

+0

흠! 클래스 CashDTO를 추가하기 전에 테스트 - ws가 성공적으로 실행되었고 CashDTO는 내 코드에서 다른 오래된 DTO와 다르지 않습니다. 왜 단지 CashDTO 클래스가 CashDTO와 비슷한 다른 DTO 클래스가 아니라 그것에 대해서 불평합니까? – othman

+0

죄송합니다. 필자는 test-w에서 최대 절전 모드 DTO를 사용하면 안된다. 나는 test-ws와 함께 사용할 다른 DTO를 만들어야한다. – othman

+0

하지만 javac가 클래스 패스에 기본적으로 javac를 가지고 있지 않다는 것이 제 질문입니까? javac 자체는 JDK c : \ Program Files (x86) \ Java \ jdk1.6.0_26 \ bin \ javac.exe 내에 있으므로 찾을 수 없습니까? (추종자를 위해, 여기에 대한 나의 수정 : http://betterlogic.com/roger/2011/07/javachibernate-woe/ comment 1 – rogerdpack