I have a Java class that is mapped to a database table using JPA. Inside this class I have a List<Code> that I need to store in database.
So the Code class is not mapped into Hibernate. Is there a way to Serialize the List<Code> without mapping the Code class into Hibernate? Thanks in advance.
Error Message:
org.hibernate.exception.SQLGrammarException: could not insert collection [com.app.Account.codes#2]
Problem is that I'm getting error when Hibernate attempts to Serialize my List.
@Entity
@Table (name="account", catalog="database1")
public class Account{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column (name = "id")
private String id
@Column (name = "type")
private String type;
@CollectionOfElements
@Column (name = "codes")
List<Code> codes;
...
...
}
public class Code implements Serializable{
//This is a basic POJO that is not mapped into Hibernate. I just want this object
//to be stored in database.
}