- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我收到错误No property u found for type com.models.entities.OrderEntity
并且我一生都无法弄清楚如何调试它的来源。我猜有一些映射不正确。
我尝试启用 log4j
,它只提供有关 org.hibernate
的详细信息。我尝试添加其他包,但它们没有被读取。我相信我的 log4j.properties
位于正确的位置。
log4j.properties
内容:
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
如何确保 log4j 记录正确的包?
我的实体:
@Entity
@Table(name = "`Order`")
@NamedQueries({
@NamedQuery(name="Order.findByUUID", query="SELECT o FROM OrderEntity o WHERE o.uuid = :uuid"),
@NamedQuery(name="Order.findByInProduction", query="SELECT o FROM OrderEntity o WHERE 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 that = (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;
}
}
堆栈跟踪:
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property u found for type com.models.entities.OrderEntity
at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:75)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:327)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:353)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:307)
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:271)
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:245)
at org.springframework.data.repository.query.parser.Part.<init>(Part.java:72)
at org.springframework.data.repository.query.parser.PartTree$OrPart.<init>(PartTree.java:180)
at org.springframework.data.repository.query.parser.PartTree$Predicate.buildTree(PartTree.java:260)
at org.springframework.data.repository.query.parser.PartTree$Predicate.<init>(PartTree.java:240)
at org.springframework.data.repository.query.parser.PartTree.<init>(PartTree.java:71)
at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:57)
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:90)
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:162)
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:68)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:279)
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:147)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:153)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:43)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
... 26 more
更新:我刚刚从数据库中删除并重新生成了实体,但仍然收到相同的错误。
最佳答案
事实证明,该问题是由与我的存储库层冲突引起的。尽管我有一个 Order.findByUUID
命名查询,我的 OrderRepository
看起来像:
@Repository
public interface OrderRepository extends JpaRepository<OrderEntity, Integer> {
OrderEntity findByUUID(@Param("uuid") String uuid);
List<OrderEntity> findByInProduction(@Param("inProduction") Boolean inProduction);
}
删除命名查询并将上述方法更改为 findByUuid
是解决方案。我仍然不确定它为什么失败,但这让我摆脱了问题并开始调试应用程序。
关于java - 未找到 com.models.entities.OrderEntity 类型的属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15845030/
我对 mongoosejs 中模型的使用感到有些困惑。 可以通过这些方式使用 mongoose 创建模型 使用 Mongoose var mongoose = require('mongoose');
我正在看 from django.db import models class Publisher(models.Model): name = models.CharField(max_len
我有自己的 html 帮助器扩展,我用这种方式 model.Reason_ID, Register.PurchaseReason) %> 这样声明的。 public static MvcHtmlS
假设模型原本是存储在CPU上的,然后我想把它移到GPU0上,那么我可以这样做: device = torch.device('cuda:0') model = model.to(device) # o
我过去读过一些关于模型的 MVC 建议,指出不应为域和 View 重用相同的模型对象;但我找不到任何人愿意讨论为什么这很糟糕。 我认为创建两个单独的模型 - 一个用于域,一个用于 View - 然后在
我正在使用pytorch构建一个像VGG16这样的简单模型,并且我已经重载了函数forward在我的模型中。 我发现每个人都倾向于使用 model(input)得到输出而不是 model.forwar
tf.keras API 中的 models 是否多余?对于某些情况,即使不使用 models,代码也能正常运行。 keras.models.sequential 和 keras.sequential
当我尝试使用 docker 镜像运行 docker 容器时遇到问题:tensorflow/serving。 我运行命令: docker run --name=tf_serving -it tensor
我有一个模型,我用管道注册了它: register_step = PythonScriptStep(name = "Register Model",
如果 View 需要访问模型中的数据,您是否认为 Controller 应: a)将模型传递给 View b)将模型的数据传递给 View c)都不;这不应该是 Controller 所关心的。让 V
我正在寻找一个可以在模型中定义的字段,该字段本质上是一个列表,因为它将用于存储多个字符串值。显然CharField不能使用。 最佳答案 您正在描述一种多对一的关系。这应该通过一个额外的 Model 进
我最近了解了 Django 中的模型继承。我使用很棒的包 django-model-utils 取得了巨大的成功。我继承自 TimeStampedModel 和 SoftDeletableModel。
我正在使用基于 resnet50 的双输出模型进行项目。一个输出用于回归任务,第二个输出用于分类任务。 我的主要问题是关于模型评估。在训练期间,我在验证集的两个输出上都取得了不错的结果: - 综合损失
我是keras的新手。现在,我将使用我使用 model.fit_generator 训练的模型来预测测试图像组。我可以使用 model.predict 吗?不确定如何使用model.predict_g
在 MVC 应用程序中,我加入了多个表并将其从 Controller 返回到 View,如下所示: | EmployeeID | ControlID | DoorAddress | DoorID |
我在使用 sails-cassandra 连接系统的 Sails 中有一个 Data 模型。数据。 Data.count({...}).exec() 返回 1,但 Data.find({...}).e
我正在使用 PrimeFaces dataTable 开发一个 jsf 页面来显示用户列表。用户存储在 Model.User 类的对象中。
我正在关注https://www.tensorflow.org/tutorials/keras/basic_classification解决 Kaggle 挑战。 但是,我不明白应该将什么样的数据输入
我是这个领域的新手。那么,你们能帮忙如何为 CNN 创建 .config 文件吗? 传递有关如何执行此操作的文档或教程将对我有很大帮助。谢谢大家。 最佳答案 这个问题对我来说没有多大意义,因为 .co
我是“物理系统建模”主题的新手。我阅读了一些基础文献,并在 Modelica 和 Simulink/Simscape 中做了一些教程。我想问你,如果我对以下内容理解正确: 符号操作是将微分代数方程组(
我是一名优秀的程序员,十分优秀!