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.rac...@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.tolb...@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.rac...@gmail.com> wrote:
>
> Please fix this.
>
>
>
> On Tue, Oct 11, 2016 at 8:28 AM, Andrew Tolbert <
> andrew.tolb...@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.rac...@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?
>
>
>
>

Reply via email to