How to persist non-trivial fields in Play Framework

Posted by AlexR on Stack Overflow See other posts from Stack Overflow or by AlexR
Published on 2012-09-29T08:05:07Z Indexed on 2012/09/29 9:37 UTC
Read the original article Hit count: 244

Filed under:
|
|

I am trying to persist complex objects using Ebeans in Play Framework (2.03). In particular, I've created a class that contains a field of type weka.classifier.Classifier (Weka is a popular machine learning library - see http://weka.sourceforge.net/doc/weka/classifiers/Classifier.html). Classifier implements Serializeable so I hoped that I can get away with something like

@Entity
@Table(name = "classifiers")
public class ClassifierData extends Model {
    @Id
    public Long id;
    public Classifier classifier;
}

However, the Evolutions script suggests the following database structure:

create table classifiers (
   id  bigint auto_increment not null,
   constraint pk_classifiers primary key (id))
)

In other words, it ignores the field of type Classifier.

(The database is MySQL if it makes any difference)

What should I do to store complex serializeable objects using Ebean/Evolutions/PlayFramework?

© Stack Overflow or respective owner

Related posts about playframework-2.0

Related posts about weka