Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA strange error.

 
Marek Kisiel
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

I can't resolve this problem:

The type [interface java.util.List] for the attribute [zamowieniaList] on the entity class [class projekttest.Klienci] is not a valid type for a serialized mapping. The attribute type must implement the Serializable interface.



Adnotations:






Could anyone help me?

Regards
 
Leonardo Carreira
Ranch Hand
Posts: 489
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mar Kis..

How about if you configure your mapping like this below?..





Please reconfirm the result either error or success..
Thanks..
 
Marek Kisiel
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for advice, but it changes nothing. I am getting still the same exception without remove @Basic(optional = false).
However if I remove @Basic(optional = false) I have another exception:

Exception Description: [class projekttest.Klienci] uses a non-entity [class projekttest.Zamowienia] as target entity in the relationship attribute [private java.util.List projekttest.Klienci.zamowieniaList].


But I am sure that Zamowienia class is a entity, It was generated but netbeans and has a adnotation:

@Entity
@Table(name = "zamowienia")
 
Leonardo Carreira
Ranch Hand
Posts: 489
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about this?..

@OneToMany(cascade = CascadeType.ALL, mappedBy = "klient", targetEntity=Klienci.class)
private List<Zamowienia> zamowieniaList=new ArrayList<Zamowienia>();

Thanks..
 
Marek Kisiel
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing still works
I'll try to do it once again without auto-generator.
Thank you again.
 
Himanshu Chitranshi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In //Zamowienia.java try with this...
@Id
@Column(name="ID")
public Long getId(){
return this.id;
}
public void setId(Long id){
this.id=id;
}

Please tell me if you get the same exception.....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic