2016-09-28 4 views
1

Ich bin neu in JavaEE. Vor kurzem arbeite ich an erholsamen Web Services mit jax-rs und JPA für die Arbeit mit Datenbanken und Netbeans als IDE und TomeEE als Web-Server.java.lang.IllegalArgumentException: Das Attribut [state_id] ist nicht im verwalteten Typ vorhanden [EntityTypeImpl @ 530144602: Städte]

über mein Problem, Ich habe eine Tabelle, die Städte genannt wurde, die 3-Spalten haben:

id, state_id, Namen

(state_id als Fremdschlüssel zu einer anderen Spalte definiert ist, Staaten genannt)

ich alle Städte auswählen möchten, die eine bestimmte state_id haben, zum Beispiel in der Tabelle 1000 Zeilen bestehen, dass ihre state_id sind 8.

dies mein JPA-Code ist:

public List<T> findByStateID(Short id){ 
     javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery(entityClass); 
     javax.persistence.criteria.Root<T> r = cq.from(entityClass); 
     cq.select(r); 
     cq.where(getEntityManager().getCriteriaBuilder().equal(r.get("state_id"), id)); 
     return getEntityManager().createQuery(cq).getResultList(); 
    } 

und dies ist der Web-Service-Code:

@GET 
    @Path("State/{id}") 
    @Produces(MediaType.APPLICATION_JSON) 
    public List<Cities> findByState(@PathParam("id") Short id){ 
     return super.findByStateID(id); 
    } 

weiß, dass mein Problem ist, dass, wenn ich auf die Ziel-URL zugreifen erhalte ich Schlag Fehler:

HTTP Status 500 - Error processing webservice request 

type Exception report 

message Error processing webservice request 

description The server encountered an internal error that prevented it from fulfilling this request. 

exception 

javax.servlet.ServletException: Error processing webservice request 
    org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:98) 
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 
    org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:65) 
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) 

root cause 

java.lang.IllegalArgumentException: The attribute [state_id] is not present in the managed type [[email protected]:Cities [ javaType: class entity.Cities descriptor: RelationalDescriptor(entity.Cities --> [DatabaseTable(cities)]), mappings: 4]]. 
    org.eclipse.persistence.internal.jpa.metamodel.ManagedTypeImpl.getAttribute(ManagedTypeImpl.java:148) 
    org.eclipse.persistence.internal.jpa.querydef.FromImpl.get(FromImpl.java:312) 
    rest.AbstractFacade.findByStateID(AbstractFacade.java:50) 
    rest.CitiesFacadeREST.findByState(CitiesFacadeREST.java:49) 
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    java.lang.reflect.Method.invoke(Method.java:498) 
    org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205) 
    org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186) 
    org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181) 
    org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:100) 
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    java.lang.reflect.Method.invoke(Method.java:498) 
    org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205) 
    org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186) 
    org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85) 
    org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:236) 
    org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:203) 
    org.apache.openejb.util.proxy.ProxyEJB$Handler.invoke(ProxyEJB.java:74) 
    rest.CitiesFacadeREST$$LocalBeanProxy.findByState(rest/CitiesFacadeREST.java) 
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    java.lang.reflect.Method.invoke(Method.java:498) 
    org.apache.openejb.server.cxf.rs.OpenEJBEJBInvoker.performInvocation(OpenEJBEJBInvoker.java:95) 
    org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) 
    org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:189) 
    org.apache.openejb.server.cxf.rs.OpenEJBEJBInvoker.invoke(OpenEJBEJBInvoker.java:68) 
    org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99) 
    org.apache.openejb.server.cxf.rs.AutoJAXRSInvoker.invoke(AutoJAXRSInvoker.java:64) 
    org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) 
    org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) 
    org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) 
    org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) 
    org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:254) 
    org.apache.openejb.server.cxf.rs.CxfRsHttpListener.doInvoke(CxfRsHttpListener.java:251) 
    org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:94) 
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 
    org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:65) 
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) 

note The full stack trace of the root cause is available in the Apache Tomcat (TomEE)/8.5.3 (7.0.1) logs. 
Apache Tomcat (TomEE)/8.5.3 (7.0.1) 

hier Die Entitätsklasse Städte:

import java.io.Serializable; 
import java.util.Collection; 
import javax.persistence.Basic; 
import javax.persistence.CascadeType; 
import javax.persistence.Column; 
import javax.persistence.Entity; 
import javax.persistence.GeneratedValue; 
import javax.persistence.GenerationType; 
import javax.persistence.Id; 
import javax.persistence.JoinColumn; 
import javax.persistence.ManyToOne; 
import javax.persistence.NamedQueries; 
import javax.persistence.NamedQuery; 
import javax.persistence.OneToMany; 
import javax.persistence.Table; 
import javax.validation.constraints.NotNull; 
import javax.validation.constraints.Size; 
import javax.xml.bind.annotation.XmlRootElement; 
import javax.xml.bind.annotation.XmlTransient; 

/** 
* 
* @author seyed 
*/ 
@Entity 
@Table(name = "cities") 
@XmlRootElement 
@NamedQueries({ 
    @NamedQuery(name = "Cities.findAll", query = "SELECT c FROM Cities c"), 
    @NamedQuery(name = "Cities.findById", query = "SELECT c FROM Cities c WHERE c.id = :id"), 
    @NamedQuery(name = "Cities.findByName", query = "SELECT c FROM Cities c WHERE c.name = :name")}) 
public class Cities implements Serializable { 

    private static final long serialVersionUID = 1L; 
    @Id 
    @GeneratedValue(strategy = GenerationType.IDENTITY) 
    @Basic(optional = false) 
    @Column(name = "id") 
    private Short id; 
    @Basic(optional = false) 
    @NotNull 
    @Size(min = 1, max = 65) 
    @Column(name = "name") 
    private String name; 
    @JoinColumn(name = "state_id", referencedColumnName = "id") 
    @ManyToOne(optional = false) 
    private States stateId; 
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "city") 
    private Collection<Users> usersCollection; 

    public Cities() { 
    } 

    public Cities(Short id) { 
     this.id = id; 
    } 

    public Cities(Short id, String name) { 
     this.id = id; 
     this.name = name; 
    } 

    public Short getId() { 
     return id; 
    } 

    public void setId(Short id) { 
     this.id = id; 
    } 

    public String getName() { 
     return name; 
    } 

    public void setName(String name) { 
     this.name = name; 
    } 

    public States getStateId() { 
     return stateId; 
    } 

    public void setStateId(States stateId) { 
     this.stateId = stateId; 
    } 

    @XmlTransient 
    public Collection<Users> getUsersCollection() { 
     return usersCollection; 
    } 

    public void setUsersCollection(Collection<Users> usersCollection) { 
     this.usersCollection = usersCollection; 
    } 

    @Override 
    public int hashCode() { 
     int hash = 0; 
     hash += (id != null ? id.hashCode() : 0); 
     return hash; 
    } 

    @Override 
    public boolean equals(Object object) { 
     // TODO: Warning - this method won't work in the case the id fields are not set 
     if (!(object instanceof Cities)) { 
      return false; 
     } 
     Cities other = (Cities) object; 
     if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { 
      return false; 
     } 
     return true; 
    } 

    @Override 
    public String toString() { 
     return "entity.Cities[ id=" + id + " ]"; 
    } 

} 

wie in den Kommentaren gesagt, änderte ich state_id zu StateID in JPA Teil und ich jetzt diesen Fehler:

HTTP Status 500 - Error processing webservice request 

type Exception report 

message Error processing webservice request 

description The server encountered an internal error that prevented it from fulfilling this request. 

exception 

javax.servlet.ServletException: Error processing webservice request 
    org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:98) 
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 
    org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:65) 
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) 

root cause 

javax.persistence.PersistenceException: Exception [EclipseLink-6078] (Eclipse Persistence Services - 2.6.3.v20160428-59c81c5): org.eclipse.persistence.exceptions.QueryException 
Exception Description: The class of the argument for the object comparison is incorrect. 
Expression: [ 
Base entity.Cities] 
Mapping: [org.eclipse.persistence.mappings.ManyToOneMapping[stateId]] 
Argument: [1] 
Query: ReadAllQuery(referenceClass=Cities) 
    org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:484) 
    rest.AbstractFacade.findByStateID(AbstractFacade.java:51) 
    rest.CitiesFacadeREST.findByState(CitiesFacadeREST.java:49) 
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    java.lang.reflect.Method.invoke(Method.java:498) 
    org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205) 
    org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186) 
    org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181) 
    org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:100) 
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    java.lang.reflect.Method.invoke(Method.java:498) 
    org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205) 
    org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186) 
    org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85) 
    org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:236) 
    org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:203) 
    org.apache.openejb.util.proxy.ProxyEJB$Handler.invoke(ProxyEJB.java:74) 
    rest.CitiesFacadeREST$$LocalBeanProxy.findByState(rest/CitiesFacadeREST.java) 
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    java.lang.reflect.Method.invoke(Method.java:498) 
    org.apache.openejb.server.cxf.rs.OpenEJBEJBInvoker.performInvocation(OpenEJBEJBInvoker.java:95) 
    org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) 
    org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:189) 
    org.apache.openejb.server.cxf.rs.OpenEJBEJBInvoker.invoke(OpenEJBEJBInvoker.java:68) 
    org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99) 
    org.apache.openejb.server.cxf.rs.AutoJAXRSInvoker.invoke(AutoJAXRSInvoker.java:64) 
    org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) 
    org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) 
    org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) 
    org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) 
    org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:254) 
    org.apache.openejb.server.cxf.rs.CxfRsHttpListener.doInvoke(CxfRsHttpListener.java:251) 
    org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:94) 
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 
    org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:65) 
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) 

root cause 

Exception [EclipseLink-6078] (Eclipse Persistence Services - 2.6.3.v20160428-59c81c5): org.eclipse.persistence.exceptions.QueryException 
Exception Description: The class of the argument for the object comparison is incorrect. 
Expression: [ 
Base entity.Cities] 
Mapping: [org.eclipse.persistence.mappings.ManyToOneMapping[stateId]] 
Argument: [1] 
Query: ReadAllQuery(referenceClass=Cities) 
    org.eclipse.persistence.exceptions.QueryException.incorrectClassForObjectComparison(QueryException.java:601) 
    org.eclipse.persistence.mappings.OneToOneMapping.buildObjectJoinExpression(OneToOneMapping.java:298) 
    org.eclipse.persistence.internal.expressions.RelationExpression.normalize(RelationExpression.java:830) 
    org.eclipse.persistence.internal.expressions.SQLSelectStatement.normalize(SQLSelectStatement.java:1474) 
    org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.buildNormalSelectStatement(ExpressionQueryMechanism.java:550) 
    org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.prepareSelectAllRows(ExpressionQueryMechanism.java:1722) 
    org.eclipse.persistence.queries.ReadAllQuery.prepareSelectAllRows(ReadAllQuery.java:885) 
    org.eclipse.persistence.queries.ReadAllQuery.prepare(ReadAllQuery.java:816) 
    org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(DatabaseQuery.java:666) 
    org.eclipse.persistence.queries.ObjectLevelReadQuery.checkPrepare(ObjectLevelReadQuery.java:911) 
    org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(DatabaseQuery.java:615) 
    org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:872) 
    org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1134) 
    org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:460) 
    org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1222) 
    org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2896) 
    org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1857) 
    org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1839) 
    org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1804) 
    org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:258) 
    org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:473) 
    rest.AbstractFacade.findByStateID(AbstractFacade.java:51) 
    rest.CitiesFacadeREST.findByState(CitiesFacadeREST.java:49) 
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    java.lang.reflect.Method.invoke(Method.java:498) 
    org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205) 
    org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186) 
    org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181) 
    org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:100) 
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    java.lang.reflect.Method.invoke(Method.java:498) 
    org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205) 
    org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186) 
    org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85) 
    org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:236) 
    org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:203) 
    org.apache.openejb.util.proxy.ProxyEJB$Handler.invoke(ProxyEJB.java:74) 
    rest.CitiesFacadeREST$$LocalBeanProxy.findByState(rest/CitiesFacadeREST.java) 
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    java.lang.reflect.Method.invoke(Method.java:498) 
    org.apache.openejb.server.cxf.rs.OpenEJBEJBInvoker.performInvocation(OpenEJBEJBInvoker.java:95) 
    org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) 
    org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:189) 
    org.apache.openejb.server.cxf.rs.OpenEJBEJBInvoker.invoke(OpenEJBEJBInvoker.java:68) 
    org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99) 
    org.apache.openejb.server.cxf.rs.AutoJAXRSInvoker.invoke(AutoJAXRSInvoker.java:64) 
    org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) 
    org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) 
    org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) 
    org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) 
    org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:254) 
    org.apache.openejb.server.cxf.rs.CxfRsHttpListener.doInvoke(CxfRsHttpListener.java:251) 
    org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:94) 
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 
    org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:65) 
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) 

note The full stack trace of the root cause is available in the Apache Tomcat (TomEE)/8.5.3 (7.0.1) logs. 
Apache Tomcat (TomEE)/8.5.3 (7.0.1) 
+1

anzeigen Klasse' entity.Cities' zu ändern. Ich glaube, deine Eigenschaft in der Klasse ist 'stateId'? – Jens

+0

wie ich schon sagte ich bin neu in dieser Sache, vielleicht dein Recht. Ich werde die Cities-Entity-Klasse –

Antwort

0

Die Abfrage verwendet standardmäßig Java-Namen. Wenn Sie Zweifel haben, können Sie einen Jpa-Metamodellgenerator einrichten, und Sie können eine typisierte Version der Attribute anstelle von Strings verwenden.

+0

setzen, wenn ich JPA mit Netbeans erzeuge (arg und utx) und ich nicht weiß, wie ich diese arg jax-rs-Web-Service-Datei an jpa übergeben soll. Ich meine von @GET .... Teil –

0

Da jpa/hibernate Property-Namen und nicht Spaltennamen verwenden, müssen Sie private States stateId statt private States state_Id verwenden.

So haben Sie equal(r.get("state_id"), id))-equal(r.get("stateId"), id)); `

+0

Ich habe getan, was Sie sagen, aber ich habe den zweiten Fehler –

+0

Es sieht aus wie ein Problem in Ihrer Verteidigung der Beziehung: @ManyToOne (optional = falsch) private states stateId; – Jens

+0

können Sie mehr erklären? –

Verwandte Themen