Moj kod:
@OneToMany(cascade = CascadeType.ALL, mappedBy = "b")
private Set<A> a= new LinkedHashSet<A>();
...
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + (int) (id ^ (id>>> 32));
result = prime * result + ((a== null) ? 0 : a.hashCode()); //tutaj error (pod spodem wrzucilem stack trace)
...
SEVERE:
java.lang.NullPointerException
at org.hibernate.engine.internal.StatefulPersistenceContext.getLoadedCollectionOwnerOrNull(StatefulPersistenceContext.java:752)
at org.hibernate.event.spi.AbstractCollectionEvent.getLoadedOwnerOrNull(AbstractCollectionEvent.java:75)
at org.hibernate.event.spi.InitializeCollectionEvent.<init>(InitializeCollectionEvent.java:36)
at org.hibernate.internal.SessionImpl.initializeCollection(SessionImpl.java:1895)
at org.hibernate.collection.internal.AbstractPersistentCollection$4.doWork(AbstractPersistentCollection.java:558)
at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:260)
at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:554)
at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:142)
at org.hibernate.collection.internal.PersistentSet.hashCode(PersistentSet.java:447)
at pewien.prywatny.pakiet.PewnaKlasa.hashCode(B.java:251)
Wiecie moze co tu sie dzieje ?