- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 intellj 、CRUD 类和相关实体创建了一个简单的 Hibernate 项目,但是当我尝试从部门检索项目时,出现此错误代码
这里涉及到类
DepartmentsEntity.java
package database_table;
import javax.persistence.*;
import java.util.List;
/**
* Created by Michele on 14/07/2017.
*/
@Entity
@Table(name = "departments", schema = "warehouse")
public class DepartmentsEntity {
private String name;
private int id;
@Basic
@Column(name = "name")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Id
@Column(name = "id")
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@OneToMany(mappedBy = "departments",cascade = {CascadeType.ALL},fetch =
FetchType.LAZY)
private List<ItemsEntity> items;
public List<ItemsEntity> getItems() {
return this.items;
}
public void setItems (List<ItemsEntity> items){
this.items = items;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DepartmentsEntity that = (DepartmentsEntity) o;
if (id != that.id) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return
false;
return true;
}
@Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + id;
return result;
}
@Override
public String toString(){
String res = "///Departments///";
res += "\nID: "+this.getId();
res += "\nname: "+this.getName();
return res;
}
}
ItemsEntity.java
package database_table;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Michele on 14/07/2017.
*/
@Entity
@Table(name = "items", schema = "warehouse")
public class ItemsEntity {
private String name;
private Integer price;
private Integer size;
private int id;
private String description;
@Basic
@Column(name = "name")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Basic
@Column(name = "price")
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
@Basic
@Column(name = "size")
public Integer getSize() {
return size;
}
public void setSize(Integer size) {
this.size = size;
}
@Id
@Column(name = "id")
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Basic
@Column(name = "description")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@ManyToOne
@JoinColumn (name = "dep" , nullable = false)//nome colonna della table items nel database warehouse
private DepartmentsEntity departments;//nome oggetto nel mappedBy di DepartmentsEntity(l'entita di destinazione)
//che contiene una List di Item
public DepartmentsEntity getDepartments(){return this.departments;}
public void setDepartments(DepartmentsEntity departments){this.departments = departments;}
@OneToMany (mappedBy = "items",fetch = FetchType.LAZY)
@Column (name = "id")
private List<MovementsEntity> movements;
/*public ArrayList<MovementsEntity> getMovements(){return this.movements;}
public void setMovements(ArrayList<MovementsEntity> movements){this.movements = movements;}*/
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ItemsEntity that = (ItemsEntity) o;
if (id != that.id) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (price != null ? !price.equals(that.price) : that.price != null) return false;
if (size != null ? !size.equals(that.size) : that.size != null) return false;
if (description != null ? !description.equals(that.description) : that.description != null) return false;
return true;
}
@Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (price != null ? price.hashCode() : 0);
result = 31 * result + (size != null ? size.hashCode() : 0);
result = 31 * result + id;
result = 31 * result + (description != null ? description.hashCode() : 0);
return result;
}
public void replaceItem(ItemsEntity item){
if(item.name!= "" || item.name!=null){
this.setName(item.name);
}
if(item.price!=null){
this.setPrice(item.price);
}
if(item.size!=null){
this.setSize(item.size);
}
if(item.description!= "" || item.description!=null){
this.setDescription(item.description);
}
if(item.departments.getName()!= "" || item.departments!=null){
this.setDepartments(item.departments);
}
}
@Override
public String toString(){
String res = "///Item///";
res += "\nID: "+this.getId();
res += "\nname: "+this.getName();
res += "\nprice: "+this.getDescription();
res += "\nstored size: "+this.getSize();
res += "\ndepartment: "+this.getDepartments().getName();
return res;
}
}
部门CRUD.java
package service;
import database_table.DepartmentsEntity;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import javax.persistence.TypedQuery;
import java.util.List;
/**
* Created by Michele on 14/07/2017.
*/
public class DepartmentsCRUD {
protected EntityManager em;
public DepartmentsCRUD (EntityManager em){
this.em = em;
}
public List<DepartmentsEntity> getDeps(){
Query query = em.createQuery("select d from DepartmentsEntity d");
return (List<DepartmentsEntity>) query.getResultList();
}
public DepartmentsEntity getDepById(int id){
/*TypedQuery<DepartmentsEntity> query = em.createQuery(
"Select d from DepartmentsEntity d where d.id = :id", DepartmentsEntity.class);
return query.setParameter("id",id).getSingleResult();*/
return em.find(DepartmentsEntity.class,id);
}
}
TestDepartmentsCRUD.java
package service;
/**
* Created by Michele on 14/07/2017.
*/
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import database_table.DepartmentsEntity;
import database_table.ItemsEntity;
import java.util.List;
public class TestDepartmentsCRUD {
public static void main (String args[]) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("jpa-example");
EntityManager em = emf.createEntityManager();
DepartmentsCRUD departmentsCRUD = new DepartmentsCRUD(em);
//////////////////////Get list of departments\\\\\\\\\\\\\\\\\\\\\\\
/*List<DepartmentsEntity> listOfDepartments = departmentsCRUD.getDeps();
for (DepartmentsEntity dep : listOfDepartments) {
System.out.println("name : "+dep.getName());
}*/
//////////////////////Get dep by id\\\\\\\\\\\\\\\\\\\\\\\
DepartmentsEntity dep = departmentsCRUD.getDepById(1);
System.out.println(dep.toString());
List<ItemsEntity> items = dep.getItems();
System.out.println("is empty? --> "+items.isEmpty());
for(ItemsEntity item:items){
System.out.println(item.toString());
}
em.close();
emf.close();
}
}
这是我的登录控制台
"C:\Program Files (x86)\Java\jdk1.8.0_131\bin\java" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2017.1.4\lib\idea_rt.jar=50573:C:\Program Files\JetBrains\IntelliJ IDEA 2017.1.4\bin" -Dfile.encoding=UTF-8 -classpath "C:\Users\Michele\Desktop\Test_Hibernate\bin;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\deploy.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\ext\access-bridge-32.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\ext\cldrdata.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\ext\dnsns.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\ext\jaccess.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\ext\jfxrt.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\ext\localedata.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\ext\nashorn.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\ext\sunec.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\ext\sunjce_provider.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\ext\sunmscapi.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\ext\sunpkcs11.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\ext\zipfs.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\javaws.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\jfr.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\jfxswt.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\jsse.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\management-agent.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\plugin.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\rt.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\envers\hibernate-envers-5.2.1.Final.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\jpa-metamodel-generator\hibernate-jpamodelgen-5.2.1.Final.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\optional\c3p0\c3p0-0.9.2.1.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\optional\c3p0\hibernate-c3p0-5.2.1.Final.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\optional\c3p0\mchange-commons-java-0.2.3.4.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\optional\ehcache\ehcache-2.10.1.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\optional\ehcache\hibernate-ehcache-5.2.1.Final.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\optional\ehcache\slf4j-api-1.7.7.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\optional\infinispan\hibernate-infinispan-5.2.1.Final-tests.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\optional\infinispan\hibernate-infinispan-5.2.1.Final.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\optional\infinispan\infinispan-commons-8.1.0.Final.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\optional\infinispan\infinispan-core-8.1.0.Final.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\optional\infinispan\jboss-marshalling-osgi-1.4.10.Final.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\optional\infinispan\jboss-transaction-api_1.1_spec-1.0.1.Final.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\optional\infinispan\jgroups-3.6.4.Final.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\optional\proxool\hibernate-proxool-5.2.1.Final.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\optional\proxool\proxool-0.8.3.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\osgi\hibernate-osgi-5.2.1.Final.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\osgi\org.osgi.compendium-4.3.1.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\osgi\org.osgi.core-4.3.1.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\required\antlr-2.7.7.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\required\cdi-api-1.1-PFD.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\required\classmate-1.3.0.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\required\dom4j-1.6.1.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\required\el-api-2.2.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\required\geronimo-jta_1.1_spec-1.1.1.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\required\hibernate-commons-annotations-5.0.1.Final.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\required\hibernate-core-5.2.1.Final.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\required\hibernate-jpa-2.1-api-1.0.0.Final.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\required\jandex-2.0.0.Final.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\required\javassist-3.20.0-GA.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\required\javax.inject-1.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\required\jboss-interceptors-api_1.1_spec-1.0.0.Beta1.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\required\jboss-logging-3.3.0.Final.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\required\jsr250-api-1.0.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\mysql-connector-5.1.8.jar;C:\Users\Michele\Desktop\Test_Hibernate\lib\Hibernate_ORM\osgi\hibernate-osgi-5.2.1.Final-karaf.xml;C:\Users\Michele\Downloads\Hibernate_Tools_509.jar" service.TestDepartmentsCRUD
lug 17, 2017 5:10:56 PM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [
name: jpa-example
...]
lug 17, 2017 5:10:56 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.2.1.Final}
lug 17, 2017 5:10:56 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000205: Loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=org.h2.Driver, hibernate.service.allow_crawling=false, hibernate.max_fetch_depth=5, hibernate.dialect=org.hibernate.dialect.H2Dialect, hibernate.format_sql=true, hibernate.generate_statistics=true, hibernate.connection.username=sa, hibernate.connection.url=jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000, hibernate.bytecode.use_reflection_optimizer=false, hibernate.connection.password=****, hibernate.connection.pool_size=5}
lug 17, 2017 5:10:56 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
lug 17, 2017 5:10:57 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
lug 17, 2017 5:10:58 PM org.hibernate.c3p0.internal.C3P0ConnectionProvider configure
INFO: HHH010002: C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/warehouse
lug 17, 2017 5:10:58 PM org.hibernate.c3p0.internal.C3P0ConnectionProvider configure
INFO: HHH10001001: Connection properties: {user=root, password=****}
lug 17, 2017 5:10:58 PM org.hibernate.c3p0.internal.C3P0ConnectionProvider configure
INFO: HHH10001003: Autocommit mode: false
lug 17, 2017 5:10:58 PM com.mchange.v2.log.MLog <clinit>
INFORMAZIONI: MLog clients using java 1.4+ standard logging.
lug 17, 2017 5:10:58 PM com.mchange.v2.c3p0.C3P0Registry banner
INFORMAZIONI: Initializing c3p0-0.9.2.1 [built 20-March-2013 10:47:27 +0000; debug? true; trace: 10]
lug 17, 2017 5:10:58 PM org.hibernate.c3p0.internal.C3P0ConnectionProvider configure
INFO: HHH10001007: JDBC isolation level: <unknown>
lug 17, 2017 5:10:58 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
INFORMAZIONI: Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@a96e5ebc [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@f7546cc7 [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, debugUnreturnedConnectionStackTraces -> false, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hge8ml9pmi3x8z7v08zo|833051, idleConnectionTestPeriod -> 2000, initialPoolSize -> 5, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 500, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 20, maxStatements -> 50, maxStatementsPerConnection -> 0, minPoolSize -> 5, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@5db05a23 [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 1hge8ml9pmi3x8z7v08zo|16d6c1e, jdbcUrl -> jdbc:mysql://localhost:3306/warehouse, properties -> {user=******, password=******} ], preferredTestQuery -> null, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false; userOverrides: {} ], dataSourceName -> null, factoryClassLocation -> null, identityToken -> 1hge8ml9pmi3x8z7v08zo|df6e3a, numHelperThreads -> 3 ]
lug 17, 2017 5:10:58 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
lug 17, 2017 5:10:58 PM org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl useContextualLobCreation
INFO: HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
lug 17, 2017 5:10:58 PM org.hibernate.envers.boot.internal.EnversServiceImpl configure
INFO: Envers integration enabled? : true
///Departments///
ID: 1
name: E-Items
lug 17, 2017 5:10:59 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
WARN: SQL Error: 1054, SQLState: 42S22
lug 17, 2017 5:10:59 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
ERROR: Unknown column 'items0_.items_ORDER' in 'field list'
Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not extract ResultSet
at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:63)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:97)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:79)
at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.getResultSet(AbstractLoadPlanBasedLoader.java:434)
at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeQueryStatement(AbstractLoadPlanBasedLoader.java:186)
at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:121)
at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:86)
at org.hibernate.loader.collection.plan.AbstractLoadPlanBasedCollectionInitializer.initialize(AbstractLoadPlanBasedCollectionInitializer.java:87)
at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:682)
at org.hibernate.event.internal.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:75)
at org.hibernate.internal.SessionImpl.initializeCollection(SessionImpl.java:2142)
at org.hibernate.collection.internal.AbstractPersistentCollection$4.doWork(AbstractPersistentCollection.java:567)
at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:249)
at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:563)
at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:132)
at org.hibernate.collection.internal.AbstractPersistentCollection$1.doWork(AbstractPersistentCollection.java:161)
at org.hibernate.collection.internal.AbstractPersistentCollection$1.doWork(AbstractPersistentCollection.java:146)
at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:249)
at org.hibernate.collection.internal.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:145)
at org.hibernate.collection.internal.PersistentList.isEmpty(PersistentList.java:118)
at service.TestDepartmentsCRUD.main(TestDepartmentsCRUD.java:35)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'items0_.items_ORDER' in 'field list'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3536)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3468)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1957)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2107)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2086)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2237)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:116)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:70)
... 18 more
Process finished with exit code 1
请帮帮我,谢谢
最佳答案
“字段列表”中存在未知列“items0_.items_ORDER”
此错误行表明 JPA 正在 ITEMS 表中搜索 items_ORDER。这表明您需要在 Items 表中创建此列。
@OneToMany (mappedBy = "items",fetch = FetchType.LAZY)@Column(名称=“id”)
这里mappedby = items表示在另一个表中应该有名为field的项目将被绑定(bind)。
关于java - 从一对多关系获取列表时出错,字段列表中的未知列 '***',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45148343/
SQLite、Content provider 和 Shared Preference 之间的所有已知区别。 但我想知道什么时候需要根据情况使用 SQLite 或 Content Provider 或
警告:我正在使用一个我无法完全控制的后端,所以我正在努力解决 Backbone 中的一些注意事项,这些注意事项可能在其他地方更好地解决......不幸的是,我别无选择,只能在这里处理它们! 所以,我的
我一整天都在挣扎。我的预输入搜索表达式与远程 json 数据完美配合。但是当我尝试使用相同的 json 数据作为预取数据时,建议为空。点击第一个标志后,我收到预定义消息“无法找到任何内容...”,结果
我正在制作一个模拟 NHL 选秀彩票的程序,其中屏幕右侧应该有一个 JTextField,并且在左侧绘制弹跳的选秀球。我创建了一个名为 Ball 的类,它实现了 Runnable,并在我的主 Draf
这个问题已经有答案了: How can I calculate a time span in Java and format the output? (18 个回答) 已关闭 9 年前。 这是我的代码
我有一个 ASP.NET Web API 应用程序在我的本地 IIS 实例上运行。 Web 应用程序配置有 CORS。我调用的 Web API 方法类似于: [POST("/API/{foo}/{ba
我将用户输入的时间和日期作为: DatePicker dp = (DatePicker) findViewById(R.id.datePicker); TimePicker tp = (TimePic
放宽“邻居”的标准是否足够,或者是否有其他标准行动可以采取? 最佳答案 如果所有相邻解决方案都是 Tabu,则听起来您的 Tabu 列表的大小太长或您的释放策略太严格。一个好的 Tabu 列表长度是
我正在阅读来自 cppreference 的代码示例: #include #include #include #include template void print_queue(T& q)
我快疯了,我试图理解工具提示的行为,但没有成功。 1. 第一个问题是当我尝试通过插件(按钮 1)在点击事件中使用它时 -> 如果您转到 Fiddle,您会在“内容”内看到该函数' 每次点击都会调用该属
我在功能组件中有以下代码: const [ folder, setFolder ] = useState([]); const folderData = useContext(FolderContex
我在使用预签名网址和 AFNetworking 3.0 从 S3 获取图像时遇到问题。我可以使用 NSMutableURLRequest 和 NSURLSession 获取图像,但是当我使用 AFHT
我正在使用 Oracle ojdbc 12 和 Java 8 处理 Oracle UCP 管理器的问题。当 UCP 池启动失败时,我希望关闭它创建的连接。 当池初始化期间遇到 ORA-02391:超过
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 9 年前。 Improve
引用这个plunker: https://plnkr.co/edit/GWsbdDWVvBYNMqyxzlLY?p=preview 我在 styles.css 文件和 src/app.ts 文件中指定
为什么我的条形这么细?我尝试将宽度设置为 1,它们变得非常厚。我不知道还能尝试什么。默认厚度为 0.8,这是应该的样子吗? import matplotlib.pyplot as plt import
当我编写时,查询按预期执行: SELECT id, day2.count - day1.count AS diff FROM day1 NATURAL JOIN day2; 但我真正想要的是右连接。当
我有以下时间数据: 0 08/01/16 13:07:46,335437 1 18/02/16 08:40:40,565575 2 14/01/16 22:2
一些背景知识 -我的 NodeJS 服务器在端口 3001 上运行,我的 React 应用程序在端口 3000 上运行。我在 React 应用程序 package.json 中设置了一个代理来代理对端
我面临着一个愚蠢的问题。我试图在我的 Angular 应用程序中延迟加载我的图像,我已经尝试过这个2: 但是他们都设置了 src attr 而不是 data-src,我在这里遗漏了什么吗?保留 d
我是一名优秀的程序员,十分优秀!