cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ali Akhtar <ali.rac...@gmail.com>
Subject Re: NamingStrategy for the Java Driver for camelCase / snake_case conversion?
Date Tue, 11 Oct 2016 04:28:46 GMT
Awesome, thank you.

Perhaps this should be updated on the docs here:
http://docs.datastax.com/en/developer/java-driver//3.1/manual/udts/



On Tue, Oct 11, 2016 at 9:27 AM, Andrew Tolbert <andrew.tolbert@datastax.com
> wrote:

> Indeed it is possible to use UDTs with the mapper (docs
> <http://datastax.github.io/java-driver/manual/object_mapper/creating/#mapping-user-types>).
> Pojos are annotated with @UDT and their fields are mapped with @Field (like
> table pojos are annotated with @Table and @Column respectively).  You are
> correct in that you can then use that type for a field on a @Table
> annotated class.
>
> Thanks,
> Andy
>
>
>
> On Mon, Oct 10, 2016 at 11:23 PM Ali Akhtar <ali.rac200@gmail.com> wrote:
>
>> Thanks.
>>
>> Btw, is it possible to use UDTs and have them mapped via the java driver?
>> If so, how does that work - do I just create a pojo for the UDT, and use
>> @Column on the fields, and it will work if I define a field in the table
>> mapping class as being of that pojo type?
>>
>> On Tue, Oct 11, 2016 at 8:57 AM, Andrew Tolbert <
>> andrew.tolbert@datastax.com> wrote:
>>
>> I agree this would be a nice mechanism for the driver mapper given the
>> difference between java field name conventions and how cql column names are
>> typically defined.   I've created JAVA-1316
>> <https://datastax-oss.atlassian.net/browse/JAVA-1316> for this.
>>
>> Thanks,
>> Andy
>>
>>
>>
>> On Mon, Oct 10, 2016 at 10:30 PM Ali Akhtar <ali.rac200@gmail.com> wrote:
>>
>> Please fix this.
>>
>>
>>
>> On Tue, Oct 11, 2016 at 8:28 AM, Andrew Tolbert <
>> andrew.tolbert@datastax.com> wrote:
>>
>> Hi Ali,
>>
>> As far as I know this hasn't changed.  Either the field name on the class
>> has to match the name of the column or you have to use the @Column with the
>> name attribute to set the column name being mapped by that field.
>>
>> Thanks,
>> Andy
>>
>> On Mon, Oct 10, 2016 at 8:03 PM Ali Akhtar <ali.rac200@gmail.com> wrote:
>>
>> In working with Jackson, it has a NamingStrategy which lets you
>> automatically map snake_case fields in json to camelCase fields on the Java
>> class.
>>
>> Last time I worked w/ Cassandra, I didn't find anything like that, and
>> had to define an @Column annotation for each field.
>>
>> Please tell me this has changed now?
>>
>>
>>
>>

Mime
View raw message