2012-04-27 57 views
0

其实我使用spring mvc 3和hibernate 3.5以及extjs作为用户界面的java web应用程序;我probleme是,当我的模型类有BigDecimal的属性这样一个Spring MVC 3 hibernate 3.5 BigDecimal JPA annonciation

import java.math.BigDecimal; 

import javax.persistence.Column; 
import javax.persistence.Entity; 
import javax.persistence.GeneratedValue; 
import javax.persistence.Id; 
import javax.persistence.Table; 

import org.codehaus.jackson.annotate.JsonAutoDetect; 

@JsonAutoDetect 
@Entity 
@Table(name="Articles") 
public class Article { 

@Id 
@GeneratedValue 
@Column(name="IDARTICLE") 
private int id; 

@Column(name="CODE") 
private String code; 

@Column(name="DESIGNATION") 
private String designation; 

@Column(name="PRIX", scale = 19, precision = 4, columnDefinition = "DECIMAL(19,4)") 
private BigDecimal prix; 

@Column(name="CPTARTICLE") 
private int cptarticle; 

@Column(name="IDPARCOM") 
private int idparcom; 


public int getId() { 
    return id; 
} 
public void setId(int id) { 
    this.id = id; 
} 
public String getCode() { 
    return code; 
} 
public void setCode(String code) { 
    this.code = code; 
} 
public String getDesignation() { 
    return designation; 
} 
public void setDesignation(String designation) { 
    this.designation = designation; 
} 
public BigDecimal getPrix() { 
    return prix; 
} 
public void setPrix(BigDecimal prix) { 
    this.prix = prix; 
} 
public int getCptarticle() { 
    return cptarticle; 
} 
public void setCptarticle(int cptArticle) { 
    this.cptarticle = cptArticle; 
} 
public int getIdparcom() { 
    return idparcom; 
    } 
     public void setIdparcom(int idParcom) { 
      this.idparcom = idParcom; 
     } 
} 

,当我做

List<Article> articles = hibernateTemplate.find("from Articles"); 

我有execption并没有在cosole眼前这个堆栈跟踪

Daemon Thread [http-bio-8080-exec-50] (Suspended) 
ArticleService$$FastClassByCGLIB$$1bae6fb8.invoke(int, Object, Object[]) line: not available  
MethodProxy.invoke(Object, Object[]) line: 191 
Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint() line: 692  
Cglib2AopProxy$CglibMethodInvocation(ReflectiveMethodInvocation).proceed() line: 150  
TransactionInterceptor.invoke(MethodInvocation) line: 108 
Cglib2AopProxy$CglibMethodInvocation(ReflectiveMethodInvocation).proceed() line: 172  
Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Object, Method, Object[], MethodProxy) line: 625 
ArticleService$$EnhancerByCGLIB$$f2eb83ca.getArticleList() line: not available 
ArticleController.read() line: 25 
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] 
NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available 
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available 
Method.invoke(Object, Object...) line: not available  
AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker(HandlerMethodInvoker).invokeHandlerMethod(Method, Object, NativeWebRequest, ExtendedModelMap) line: 174 
AnnotationMethodHandlerAdapter.invokeHandlerMethod(HttpServletRequest, HttpServletResponse, Object) line: 421 
AnnotationMethodHandlerAdapter.handle(HttpServletRequest, HttpServletResponse, Object) line: 409  
DispatcherServlet.doDispatch(HttpServletRequest, HttpServletResponse) line: 771 
DispatcherServlet.doService(HttpServletRequest, HttpServletResponse) line: 716 
DispatcherServlet(FrameworkServlet).processRequest(HttpServletRequest, HttpServletResponse) line: 644 
DispatcherServlet(FrameworkServlet).doGet(HttpServletRequest, HttpServletResponse) line: 549  
DispatcherServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse) line: 621 
DispatcherServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 722 
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 305 
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 210 
StandardWrapperValve.invoke(Request, Response) line: 224  
StandardContextValve.invoke(Request, Response) line: 169  
NonLoginAuthenticator(AuthenticatorBase).invoke(Request, Response) line: 472  
StandardHostValve.invoke(Request, Response) line: 168 
ErrorReportValve.invoke(Request, Response) line: 98 
AccessLogValve.invoke(Request, Response) line: 927 
StandardEngineValve.invoke(Request, Response) line: 118 
CoyoteAdapter.service(Request, Response) line: 407 
Http11Processor(AbstractHttp11Processor<S>).process(SocketWrapper<S>) line: 987 
Http11Protocol$Http11ConnectionHandler(AbstractProtocol$AbstractConnectionHandler<S,P>).process(SocketWrapper<S>, SocketStatus) line: 579 
JIoEndpoint$SocketProcessor.run() line: 309 
ThreadPoolExecutor(ThreadPoolExecutor).runWorker(ThreadPoolExecutor$Worker) line: not available 
ThreadPoolExecutor$Worker.run() line: not available 
TaskThread(Thread).run() line: not available  

somme请帮我请

+0

你能显示完整的堆栈跟踪吗? – mprabhat 2012-04-27 07:20:34

+0

我在帖子后面添加了跟踪 – user820688 2012-04-27 07:30:59

+0

您的堆栈跟踪中似乎没有看到实际的异常... – esej 2012-04-27 10:19:01

回答

0

这是一个愚蠢的错误,我必须做列表文章= hibernateTemplate.find(“来自Article”);没有s的文章,因为这是类的名称:-)而不是表的名称。