java - No property u found for type com.models.entities.OrderEntity -
i'm receiving error no property u found type com.models.entities.orderentity
, life of me can't figure out how debug coming from. i'm guessing there's mapping incorrect.
i've tried enabling log4j
gives me details on org.hibernate
. tried adding other packages aren't being read. believe log4j.properties
in right location.
log4j.properties
contents:
log4j.rootcategory=debug, stdout log4j.appender.stdout=org.apache.log4j.consoleappender log4j.appender.stdout.layout=org.apache.log4j.patternlayout log4j.appender.stdout.layout.conversionpattern=%d{absolute} %5p %t %c:%l - %m%n log4j.category.org.springframework.data=debug,stdout log4j.category.com.models.entities =debug,stdout
what can ensure log4j logging correct packages?
my entity:
@entity @table(name = "`order`") @namedqueries({ @namedquery(name="order.findbyuuid", query="select o orderentity o o.uuid = :uuid"), @namedquery(name="order.findbyinproduction", query="select o orderentity o o.inproduction = :inproduction") }) public class orderentity { private integer id; @javax.persistence.column(name = "id", nullable = false, insertable = true, updatable = true, length = 10, precision = 0) @generatedvalue @id public integer getid() { return id; } public void setid(integer id) { this.id = id; } private string uuid; @javax.persistence.column(name = "uuid", nullable = false, insertable = true, updatable = true, length = 128, precision = 0) @basic public string getuuid() { return uuid; } public void setuuid(string uuid) { this.uuid = uuid; } private boolean inproduction; @javax.persistence.column(name = "in_production", nullable = false, insertable = true, updatable = true, length = 0, precision = 0) @basic public boolean getinproduction() { return inproduction; } public void setinproduction(boolean inproduction) { this.inproduction = inproduction; } private timestamp updated; @javax.persistence.column(name = "updated", nullable = true, insertable = true, updatable = true, length = 19, precision = 0) @basic public timestamp getupdated() { return updated; } public void setupdated(timestamp updated) { this.updated = updated; } private timestamp created; @javax.persistence.column(name = "created", nullable = false, insertable = true, updatable = true, length = 19, precision = 0) @basic public timestamp getcreated() { return created; } public void setcreated(timestamp created) { this.created = created; } @override public boolean equals(object o) { if (this == o) return true; if (o == null || getclass() != o.getclass()) return false; orderentity = (orderentity) o; if (created != null ? !created.equals(that.created) : that.created != null) return false; if (id != null ? !id.equals(that.id) : that.id != null) return false; if (inproduction != null ? !inproduction.equals(that.inproduction) : that.inproduction != null) return false; if (updated != null ? !updated.equals(that.updated) : that.updated != null) return false; if (uuid != null ? !uuid.equals(that.uuid) : that.uuid != null) return false; return true; } @override public int hashcode() { int result = id != null ? id.hashcode() : 0; result = 31 * result + (uuid != null ? uuid.hashcode() : 0); result = 31 * result + (inproduction != null ? inproduction.hashcode() : 0); result = 31 * result + (updated != null ? updated.hashcode() : 0); result = 31 * result + (created != null ? created.hashcode() : 0); return result; } private vendorentity vendor; @manytoone @javax.persistence.joincolumn(name = "vendor_id", referencedcolumnname = "id", nullable = false) public vendorentity getvendor() { return vendor; } public void setvendor(vendorentity vendor) { this.vendor = vendor; } private shippingdestinationentity shippingdestination; @manytoone @javax.persistence.joincolumn(name = "shipping_destination_id", referencedcolumnname = "id", nullable = false) public shippingdestinationentity getshippingdestination() { return shippingdestination; } public void setshippingdestination(shippingdestinationentity shippingdestination) { this.shippingdestination = shippingdestination; } private collection<ordercustomfieldentity> ordercustomfields; @onetomany(mappedby = "order") public collection<ordercustomfieldentity> getordercustomfields() { return ordercustomfields; } public void setordercustomfields(collection<ordercustomfieldentity> ordercustomfields) { this.ordercustomfields = ordercustomfields; } private collection<productentity> products; @onetomany(mappedby = "order") public collection<productentity> getproducts() { return products; } public void setproducts(collection<productentity> products) { this.products = products; } }
the stack trace:
caused by: org.springframework.data.mapping.propertyreferenceexception: no property u found type com.models.entities.orderentity @ org.springframework.data.mapping.propertypath.<init>(propertypath.java:75) @ org.springframework.data.mapping.propertypath.create(propertypath.java:327) @ org.springframework.data.mapping.propertypath.create(propertypath.java:353) @ org.springframework.data.mapping.propertypath.create(propertypath.java:307) @ org.springframework.data.mapping.propertypath.from(propertypath.java:271) @ org.springframework.data.mapping.propertypath.from(propertypath.java:245) @ org.springframework.data.repository.query.parser.part.<init>(part.java:72) @ org.springframework.data.repository.query.parser.parttree$orpart.<init>(parttree.java:180) @ org.springframework.data.repository.query.parser.parttree$predicate.buildtree(parttree.java:260) @ org.springframework.data.repository.query.parser.parttree$predicate.<init>(parttree.java:240) @ org.springframework.data.repository.query.parser.parttree.<init>(parttree.java:71) @ org.springframework.data.jpa.repository.query.parttreejpaquery.<init>(parttreejpaquery.java:57) @ org.springframework.data.jpa.repository.query.jpaquerylookupstrategy$createquerylookupstrategy.resolvequery(jpaquerylookupstrategy.java:90) @ org.springframework.data.jpa.repository.query.jpaquerylookupstrategy$createifnotfoundquerylookupstrategy.resolvequery(jpaquerylookupstrategy.java:162) @ org.springframework.data.jpa.repository.query.jpaquerylookupstrategy$abstractquerylookupstrategy.resolvequery(jpaquerylookupstrategy.java:68) @ org.springframework.data.repository.core.support.repositoryfactorysupport$queryexecutormethodinterceptor.<init>(repositoryfactorysupport.java:279) @ org.springframework.data.repository.core.support.repositoryfactorysupport.getrepository(repositoryfactorysupport.java:147) @ org.springframework.data.repository.core.support.repositoryfactorybeansupport.getobject(repositoryfactorybeansupport.java:153) @ org.springframework.data.repository.core.support.repositoryfactorybeansupport.getobject(repositoryfactorybeansupport.java:43) @ org.springframework.beans.factory.support.factorybeanregistrysupport.dogetobjectfromfactorybean(factorybeanregistrysupport.java:142) ... 26 more
update: deleted , regenerated entities database , still receive same error.
it turns out, issue caused conflicts repository layer. despite me having order.findbyuuid
named query , orderrepository
looking like:
@repository public interface orderrepository extends jparepository<orderentity, integer> { orderentity findbyuuid(@param("uuid") string uuid); list<orderentity> findbyinproduction(@param("inproduction") boolean inproduction); }
removing named query , change above method findbyuuid
solution. i'm still unsure why failing, allowed me rid of issue , begin debugging application.
Comments
Post a Comment