You're right, it's a bug

 I have created an issue here to fix it here:
https://github.com/doanduyhai/Achilles/issues/240

 Fortunately you can use the query API right now to insert the static
columns:

 PreparedStatement ps = .... INSERT INTO ....
 BoundStatement bs = ps.bind(...)

 manager.query().nativeQuery(bs).execute();

 Optionally you can also use update DSL to set those static values:

 manager
     .dsl()
     .updateStatic()
     .fromBaseTable()
     .managet_Set("rahul")
     .location_Set("india)
     .where()
     .teamname_Eq("raman")
     .execute();

On Thu, Mar 3, 2016 at 9:02 AM, Raman Gugnani <raman.gugn...@snapdeal.com>
wrote:

> Hi
>
> I am to trying to insert data into cassandra using achilles which contains
> only partition key and static columns(all other columns and clustering key
> are null), but getting error
>
> info.archinnov.achilles.exception.AchillesException: Field 'membername'
> in entity of type 'com.xxx.domain.cassandra.entity.TeamMember' should not
> be null because it is a clustering column
>
>
> I am trying below insert through achilles
>
> TeamMember teamMember = new TeamMember();
> teamMember.setTeamname("raman");
> teamMember.setManager("rahul");
> teamMember.setLocation("india");
>
>
> manager.crud().insert(teamMember).withInsertStrategy(InsertStrategy.NOT_NULL_FIELDS).execute();
>
>
>
> But as per the refrence link it is possible to insert static columns only
> with partition key.
>
> reference link :
> https://blogs.infosupport.com/static-columns-in-cassandra-and-their-benefits/
>
> CREATE TABLE teammember_by_team (
>   teamname text,
>   manager text static,
>   location text static,
>   membername text,
>   nationality text,
>   position text,
>   PRIMARY KEY ((teamname), membername)
> );
>
> INSERT INTO teammember_by_team (teamname, manager, location)
> VALUES (‘Red Bull’, ‘Christian Horner’, ‘<unknown>’);
>
> teamname  | membername | location | manager          | nationality | position
> ----------+------------+----------+------------------+-------------+----------
>  Red Bull |       null | <unkown> | Christian Horner |        null |     null
>
>
>
>
>
> --
> Thanks & Regards
>
> Raman Gugnani
> *Senior Software Engineer | CaMS*
> M: +91 8588892293 | T: 0124-6600000 | EXT: 14255
> ASF Centre A | 2nd Floor | CA-2130 | Udyog Vihar Phase IV |
> Gurgaon | Haryana | India
>
> *Disclaimer:* This communication is for the sole use of the addressee and
> is confidential and privileged information. If you are not the intended
> recipient of this communication, you are prohibited from disclosing it and
> are required to delete it forthwith. Please note that the contents of this
> communication do not necessarily represent the views of Jasper Infotech
> Private Limited ("Company"). E-mail transmission cannot be guaranteed to be
> secure or error-free as information could be intercepted, corrupted, lost,
> destroyed, arrive late or incomplete, or contain viruses. The Company,
> therefore, does not accept liability for any loss caused due to this
> communication. *Jasper Infotech Private Limited, Registered Office: 1st
> Floor, Plot 238, Okhla Industrial Estate, New Delhi - 110020 INDIA CIN:
> U72300DL2007PTC168097*
>

Reply via email to