wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes JPA strange error. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "JPA strange error." Watch "JPA strange error." New topic
Author

JPA strange error.

Marek Kisiel
Greenhorn

Joined: Sep 26, 2009
Posts: 7
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

Joined: Apr 07, 2009
Posts: 489

Hi Mar Kis..

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





Please reconfirm the result either error or success..
Thanks..


Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
Marek Kisiel
Greenhorn

Joined: Sep 26, 2009
Posts: 7
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

Joined: Apr 07, 2009
Posts: 489

How about this?..

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

Thanks..
Marek Kisiel
Greenhorn

Joined: Sep 26, 2009
Posts: 7
Nothing still works
I'll try to do it once again without auto-generator.
Thank you again.
Himanshu Chitranshi
Greenhorn

Joined: Sep 06, 2008
Posts: 6
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.....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPA strange error.
 
Similar Threads
How to Write Left Outer Join
Mysql auto generated PK used for another table and JPA
Error: Entity <name> has no Id or EmbeddedId
JPA - need help with query
Servlet doesn't persist on db