내 database.I이 하나의 테이블에 데이터를 삽입 할 수 있어요 만에 시도 물건을 삽입 할 때 아주 이상한 문제를 내가 MySQL을 사용 JPA 기반 응용 프로그램을 구축하고 있고 ecliselink.I해야 함은 한 대에 올 때 그 반대도 마찬가지다. 현재는 2 개의 주 테이블과 1 개의 참조 테이블 (다른 두 테이블의 외래 키를 가지고있다.)이있다. 데이터베이스 테이블에 "시퀀스"가 없기 때문에 이상하다. 데이터를 삽입하려고 할 때 내 모든 테이블에 나는이 예외 얻을 : 다른 사람이 매우 유사에만 때문에 하나 개의 클래스를 게시하고JPA/MySQL의 문제
[EL Info]: 2012-03-15 17:52:28.64--ServerSession(18621340)--EclipseLink, version: Eclipse Persistence Services - 2.3.2.v20111125-r10461
[EL Info]: 2012-03-15 17:52:29.23--ServerSession(18621340)--file:/D:/git-eclipse/Martin/reference/build/classes/_reference login successful
[EL Warning]: 2012-03-15 17:52:29.389--ClientSession(31843177)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'eclipse1.sequence' doesn't exist
Error Code: 1146
Call: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?
bind => [2 parameters bound]
Query: DataModifyQuery(name="SEQUENCE" sql="UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?")
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'eclipse1.sequence' doesn't exist
Error Code: 1146
Call: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?
bind => [2 parameters bound]
Query: DataModifyQuery(name="SEQUENCE" sql="UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?")
[EL Info]: 2012-03-15 17:52:29.394--ServerSession(18621340)--file:/D:/git-eclipse/Martin/reference/build/classes/_reference logout successful
Exception in thread "main" java.lang.IllegalStateException: Attempting to execute an operation on a closed EntityManager.
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.verifyOpen(EntityManagerImpl.java:1665)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.close(EntityManagerImpl.java:1529)
at OneToManyRelation.main(OneToManyRelation.java:47)
을
@Entity
@Table(name="category")
public class Category {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="CategoryID")
private int CategoryID;
/**
* @return the id
*/
public int getId() {
return CategoryID;
}
/**
* @param id the id to set
*/
public void setId(int CategoryID) {
this.CategoryID = CategoryID;
}
@Column(name="category", nullable=false, length=50, insertable=true)
private String category;
/**
* @return the category
*/
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
@OneToMany(cascade=CascadeType.ALL)
@JoinTable(name = "templateemail", joinColumns = {
@JoinColumn(name="categoryId", unique = true)
},
inverseJoinColumns = {
@JoinColumn(name="templateId")
}
)
private Set<Template> template;
/**
*
*/
public Set<Template> getChildren() {
return template;
}
/**
*
*/
public void setChildren(Set<Template> template) {
this.template = template;
}
}
,
내 코드에 어떤 문제가 있는지 알고 있습니까? 그것이 뭐가 잘못 됐는지 찾아 도움이 될 코드를보고 미리
코드가 필요합니다. 감사합니다. – Woot4Moo
@ Martin 귀하가 게시 한 내용은 귀하의 코드가 아닙니다. 그러면 어떻게 잘못 됐는지 말할 수 있습니까? –
죄송합니다. 저는 여기 아주 새로운데, 제 질문을 개선하기 위해 최선을 다할 것입니다. –