valchkou / cassandra-driver-mapping

JPA addon for DataStax Java Driver for Cassandra
57 stars 24 forks source link

Cannot map "long" type in POJO to "timestamp" type in Cassandra #49

Closed vshardul closed 9 years ago

vshardul commented 9 years ago

I am creating the schema in AVRO, which does not support the Date type. Hence, have to mark my field type as long. Now, in cassandra, the field is a timestamp. How can i override the field type in the POJO or provide an override method for mapping of fields ? I tried using ColumnDefinition annotation but it does not work. Also, overwriting the mapping dictionary works for writes but reads are broken.

valchkou commented 9 years ago

Hi, I am trying to reproduce you case, please confirm cassandra column type: timestamp java property type: long

vshardul commented 9 years ago

Correct.

Sent from my iPhone

On Feb 9, 2015, at 10:08 PM, Eugene notifications@github.com wrote:

Hi, I am trying to reproduce you case, please confirm cassandra column type: timestamp java property type: long

— Reply to this email directly or view it on GitHub.

vshardul commented 9 years ago

Thanks for taking a look !

Sent from my iPhone

On Feb 9, 2015, at 10:08 PM, Eugene notifications@github.com wrote:

Hi, I am trying to reproduce you case, please confirm cassandra column type: timestamp java property type: long

— Reply to this email directly or view it on GitHub.

valchkou commented 9 years ago

fixed and should be on mvn central shortly. use ColumnDefinition annotation:

@Column(columnDefinition="TIMESTAMP") 
private long longstamp; 
vshardul commented 9 years ago

Thank you !