0

I've seen a lot of Kundera examples where the object being store is fairly simple. You have something like a Car.class and it contains a couple String variables maybe an int mapped using the @Column annotation. I've even seen some List, Set and Map variables as well as the cqlsh to create a column of those types.

What I haven't seen is a custom object I created within an object and how that would be represented in a Cassandra DB.

For example:

public Class ContainerShip {

    @Column(name="container")
    Container myContainer;
}

public Class Container {
    @Column(name="containerName)
    String containerName;
}

Could I store ContainerShip into Cassandra, using Kundera with em.persist(myShip)?

If I can what would the cqlsh for creating the "container" column look like?

4

1 回答 1

2

您可以将容器对象嵌入为可嵌入实体。

@Entity 公共类 ContainerShip {

@Column(name="container")
@Embedded
Container myContainer;

}

@Embeddable 公共类容器 {

@Column(name="containerName)
String containerName;

}

于 2014-01-15T18:00:34.413 回答