您好,我有一个与Maven和Jboss的RSSFEED知道我尝试将主题添加到新闻源但我收到此错误:
14:02:43,526 WARN [com.arjuna.ats.arjuna] (default task-10) ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffffc0a80185:737c90a9:552bae74:4b, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@694357 >: javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of Topic.id
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1763) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1677) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1683) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.jpa.spi.AbstractEntityManagerImpl$CallbackExceptionMapperImpl.mapManagedFlushFailure(AbstractEntityManagerImpl.java:1882) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackCoordinatorNonTrackingImpl.java:119) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:50) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
我尝试使用我的Topic.java和News.Java进行@ManytoMany
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.*;
@Table(name = "Topic")
@Entity
public class Topic implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO, generator="seq_topic")
@SequenceGenerator(name="seq_topic", sequenceName="seq_topic", allocationSize=1)
private int id;
private String name;
public int getId() {
return id;
}
@ManyToMany (fetch = FetchType.EAGER, mappedBy = "topic")
private List<News> News = new ArrayList<>();
public List<News> getNews() {
return News;
}
public void setNews(List<News> news) {
News = news;
}
public void setId(int id) {
this.id = id;
}
public Topic(){
}
public Topic(String name){
this.name =name;
}
public String getName() {
return name;
}
public void setName(String name) {
name = name;
}
@Override
public String toString() {
return name;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Topic other = (Topic) obj;
if (id != other.id)
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
}
现在我真的不知道问题出在哪里,因为我有一个吸气剂和Setter Methode!