openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fay Wang <fyw...@yahoo.com>
Subject Re: Query problem with open jpa 1.0.2
Date Tue, 08 Jul 2008 23:32:02 GMT
Hi,
   Please do the following:

     select j from job j


-fay

--- On Tue, 7/8/08, tao <tao_dong_cn@yahoo.com> wrote:

> From: tao <tao_dong_cn@yahoo.com>
> Subject: Query problem with open jpa 1.0.2
> To: users@openjpa.apache.org
> Date: Tuesday, July 8, 2008, 3:30 PM
> Hi, I'm working on a project using openjpa 1.0.2. I got
> org.apache.openjpa.persistence.ArgumentException while
> executing a simple
> query today, wish someone can help me on this issue. Thanks
> 
> The query I'm trying to execute is:
> "select job from job j"
> Moreover there is no problem for me to create a new job
> record.
> 
> Three related persistence classes are defined as the
> following:
> 
> @Table(name = "job")
> @Entity(name = "job")
> public class Job implements Serializable{
> 	@Id
> 	@Column (name = "job_id")
> 	@GeneratedValue(strategy = GenerationType.IDENTITY)
> 	private long jobId;
> 	
> 	@Column (name = "job_name", length = 255,
> nullable = false)
> 	private String jobName;
> 	
> 	@Column
> 	private String status;
> 	
> 	@ManyToOne (optional = false)
> 	@JoinColumn(name = "create_by",
> referencedColumnName = "user_id")
> 	private User createUser;
> 	
> 	@Column (name = "create_time")
> 	private Date createTime;
> 	
> 	@ManyToOne (optional = true)
> 	@JoinColumn(name = "update_by",
> referencedColumnName = "user_id")
> 	private User updateUser;
> 	
> 	@Column (name = "update_time")
> 	private Date updateTime;
> 	
> 	@ManyToOne (optional = false, fetch = FetchType.EAGER)
> 	@JoinColumn(name = "proj_lead_id",
> referencedColumnName = "user_id")
> 	private User projectLead;
> 	
> 	@ManyToOne (optional = false, fetch = FetchType.EAGER)
> 	@JoinColumn(name = "designer_id",
> referencedColumnName = "user_id")
> 	private User designer;
> 		
> 	@Column (name = "approve_by")
> 	private String approveBy;
> 	
> 	@Column (name = "concept_date")
> 	private Date conceptDate;
> 	
> 	@Column (name = "vendor_due_date")
> 	private Date vendorDueDate;
> 	
> 	@Column (name = "release_date")
> 	private Date releaseDate;
> 	...
> }
> 
> @Entity(name = "user")
> @Table(name = "usr_user")
> public class User implements Serializable {
> 
> 	private static final long serialVersionUID = 3L;
> 	
> 	@Id
> 	@Column (name = "user_id")
> 	@GeneratedValue(strategy = GenerationType.IDENTITY)
> 	private long userId;
> 	
> 	@Column
> 	private String password;
> 	
> 	@Column (name = "user_name", length = 20,
> nullable = false)
> 	private String userName;
> 	
> 	@Column (name = "first_name", length = 32,
> nullable = false)
> 	private String firstName;
> 	
> 	@Column (name = "last_name", length = 32,
> nullable = false)
> 	private String lastName;
> 	
> 	@Column (name = "mid_name", length = 20,
> nullable = true)
> 	private String midName;
> 
>         @ManyToOne (optional = false, fetch =
> FetchType.EAGER)
> 	@JoinColumn(name = "role_id",
> referencedColumnName = "role_id")
> 	private Role role;
> 
>         ...
> }
> 
> @Entity (name = "role")
> @Table(name = "role")
> public class Role {
> 	@Id
> 	@Column (name="role_id")
> 	@GeneratedValue(strategy = GenerationType.IDENTITY)
> 	private long roleId;
> 	
> 	@Column (name="role_name", length = 20, nullable
> = false)
> 	private String roleName;
>        ...
> }
> 
> and the exception details I got are
> javax.faces.FacesException: Error calling action method of
> component with id
> job-search-form:search-button
> 	at
> org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:69)
> 	at
> javax.faces.component.UICommand.broadcast(UICommand.java:121)
> 	at
> javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:292)
> 	at
> javax.faces.component.UIViewRoot.process(UIViewRoot.java:209)
> 	at
> javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:117)
> 	at
> org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
> 	at
> org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
> 	at
> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
> 	at
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:148)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at
> org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> 	at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
> 	at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> 	at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> 	at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> 	at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
> 	at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
> 	at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
> 	at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> 	at java.lang.Thread.run(Thread.java:595)
> Caused by: javax.faces.el.EvaluationException:
> javax.el.ELException:
> /web/searchJob.xhtml @278,43
> action="#{jobBacking.search}":
> org.springframework.dao.InvalidDataAccessApiUsageException:
> nested exception
> is <openjpa-1.0.2-r420667:627158 nonfatal user error>
> org.apache.openjpa.persistence.ArgumentException: null
> 	at
> javax.faces.component._MethodExpressionToMethodBinding.invoke(_MethodExpressionToMethodBinding.java:79)
> 	at
> org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:54)
> 	... 23 more
> Caused by: javax.el.ELException: /web/searchJob.xhtml
> @278,43
> action="#{jobBacking.search}":
> org.springframework.dao.InvalidDataAccessApiUsageException:
> nested exception
> is <openjpa-1.0.2-r420667:627158 nonfatal user error>
> org.apache.openjpa.persistence.ArgumentException: null
> 	at
> com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:74)
> 	at
> javax.faces.component._MethodExpressionToMethodBinding.invoke(_MethodExpressionToMethodBinding.java:75)
> 	... 24 more
> Caused by:
> org.springframework.dao.InvalidDataAccessApiUsageException:
> nested exception is <openjpa-1.0.2-r420667:627158
> nonfatal user error>
> org.apache.openjpa.persistence.ArgumentException: null
> 	at
> org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:269)
> 	at
> org.springframework.orm.jpa.DefaultJpaDialect.translateExceptionIfPossible(DefaultJpaDialect.java:120)
> 	at
> org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:212)
> 	at
> org.springframework.orm.jpa.JpaAccessor.translateIfNecessary(JpaAccessor.java:152)
> 	at
> org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:190)
> 	at
> org.springframework.orm.jpa.JpaTemplate.executeFind(JpaTemplate.java:152)
> 	at
> org.springframework.orm.jpa.JpaTemplate.find(JpaTemplate.java:299)
> 	at
> org.springframework.orm.jpa.JpaTemplate.find(JpaTemplate.java:295)
> 	at com.xyz.dao.JobDAO.searchJob(JobDAO.java:209)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:301)
> 	at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
> 	at $Proxy11.searchJob(Unknown Source)
> 	at com.xyz.backing.JobBacking.search(JobBacking.java:157)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at org.apache.el.parser.AstValue.invoke(AstValue.java:152)
> 	at
> org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
> 	at
> com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
> 	... 25 more
> Caused by: <openjpa-1.0.2-r420667:627158 nonfatal user
> error>
> org.apache.openjpa.persistence.ArgumentException: null
> 	at
> org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:808)
> 	at
> org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:769)
> 	at
> org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:765)
> 	at
> org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:517)
> 	at
> org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:238)
> 	at
> org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:277)
> 	at
> org.springframework.orm.jpa.JpaTemplate$9.doInJpa(JpaTemplate.java:307)
> 	at
> org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:185)
> 	... 44 more
> Caused by: java.lang.NullPointerException
> 	at
> org.apache.openjpa.jdbc.kernel.exps.PCPath.initialize(PCPath.java:445)
> 	at
> org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.initialize(SelectConstructor.java:197)
> 	at
> org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.newSelect(SelectConstructor.java:119)
> 	at
> org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.evaluate(SelectConstructor.java:73)
> 	at
> org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.createWhereSelects(JDBCStoreQuery.java:331)
> 	at
> org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeQuery(JDBCStoreQuery.java:171)
> 	at
> org.apache.openjpa.kernel.ExpressionStoreQuery$DataStoreExecutor.executeQuery(ExpressionStoreQuery.java:676)
> 	at
> org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:988)
> 	at
> org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:799)
> 	... 51 more 
> -- 
> View this message in context:
> http://n2.nabble.com/Query-problem-with-open-jpa-1.0.2-tp395802p395802.html
> Sent from the OpenJPA Users mailing list archive at
> Nabble.com.


      

Mime
View raw message