Springboot cassandra frozen value not recognised
I have a springboot application which I hooked up with cassandra. I am trying to create a map inside a map but getting the below exception. Seems to me that even though I use @FrozenValue
, it is still sending the cal without the keyword frozen
Error
Caused by: org.springframework.data.cassandra.CassandraInvalidQueryException: Query; CQL [CREATE TABLE IF NOT EXISTS assessmentsubmissionentity (studentid text, assessmentid text, values map<text, map<text, text>>, PRIMARY KEY ((studentid, assessmentid)));]; Non-frozen collections are not allowed inside collections: map<text, map<text, text>>; nested exception is com.datastax.driver.core.exceptions.InvalidQueryException: Non-frozen collections are not allowed inside collections: map<text, map<text, text>>
at org.springframework.data.cassandra.core.cql.CassandraExceptionTranslator.translate(CassandraExceptionTranslator.java:139) ~[spring-data-cassandra-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.data.cassandra.core.cql.CassandraAccessor.translate(CassandraAccessor.java:334) ~[spring-data-cassandra-2.1.2.RELEASE.jar:2.1.2.RELEASE]
Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: Non-frozen collections are not allowed inside collections: map<text, map<text, text>>
at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:49) ~[cassandra-driver-core-3.6.0.jar:na]
Code
@Table
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class AssessmentSubmissionEntity implements Serializable {
@PrimaryKeyColumn(type = PrimaryKeyType.PARTITIONED)
private String studentId;
@PrimaryKeyColumn(type = PrimaryKeyType.PARTITIONED)
private String assessmentId;
@FrozenValue
@Column
private Map <String, Map<String, String>> values;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AssessmentSubmissionEntity that = (AssessmentSubmissionEntity) o;
return Objects.equals(studentId, that.studentId) &&
Objects.equals(assessmentId, that.assessmentId) &&
Objects.equals(values, that.values);
}
@Override
public int hashCode() {
return Objects.hash(studentId, assessmentId, values);
}
}
Maven
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-cassandra</artifactId>
<exclusions>
<exclusion>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-mapping</artifactId>
</dependency>
spring-boot cassandra
add a comment |
I have a springboot application which I hooked up with cassandra. I am trying to create a map inside a map but getting the below exception. Seems to me that even though I use @FrozenValue
, it is still sending the cal without the keyword frozen
Error
Caused by: org.springframework.data.cassandra.CassandraInvalidQueryException: Query; CQL [CREATE TABLE IF NOT EXISTS assessmentsubmissionentity (studentid text, assessmentid text, values map<text, map<text, text>>, PRIMARY KEY ((studentid, assessmentid)));]; Non-frozen collections are not allowed inside collections: map<text, map<text, text>>; nested exception is com.datastax.driver.core.exceptions.InvalidQueryException: Non-frozen collections are not allowed inside collections: map<text, map<text, text>>
at org.springframework.data.cassandra.core.cql.CassandraExceptionTranslator.translate(CassandraExceptionTranslator.java:139) ~[spring-data-cassandra-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.data.cassandra.core.cql.CassandraAccessor.translate(CassandraAccessor.java:334) ~[spring-data-cassandra-2.1.2.RELEASE.jar:2.1.2.RELEASE]
Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: Non-frozen collections are not allowed inside collections: map<text, map<text, text>>
at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:49) ~[cassandra-driver-core-3.6.0.jar:na]
Code
@Table
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class AssessmentSubmissionEntity implements Serializable {
@PrimaryKeyColumn(type = PrimaryKeyType.PARTITIONED)
private String studentId;
@PrimaryKeyColumn(type = PrimaryKeyType.PARTITIONED)
private String assessmentId;
@FrozenValue
@Column
private Map <String, Map<String, String>> values;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AssessmentSubmissionEntity that = (AssessmentSubmissionEntity) o;
return Objects.equals(studentId, that.studentId) &&
Objects.equals(assessmentId, that.assessmentId) &&
Objects.equals(values, that.values);
}
@Override
public int hashCode() {
return Objects.hash(studentId, assessmentId, values);
}
}
Maven
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-cassandra</artifactId>
<exclusions>
<exclusion>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-mapping</artifactId>
</dependency>
spring-boot cassandra
add a comment |
I have a springboot application which I hooked up with cassandra. I am trying to create a map inside a map but getting the below exception. Seems to me that even though I use @FrozenValue
, it is still sending the cal without the keyword frozen
Error
Caused by: org.springframework.data.cassandra.CassandraInvalidQueryException: Query; CQL [CREATE TABLE IF NOT EXISTS assessmentsubmissionentity (studentid text, assessmentid text, values map<text, map<text, text>>, PRIMARY KEY ((studentid, assessmentid)));]; Non-frozen collections are not allowed inside collections: map<text, map<text, text>>; nested exception is com.datastax.driver.core.exceptions.InvalidQueryException: Non-frozen collections are not allowed inside collections: map<text, map<text, text>>
at org.springframework.data.cassandra.core.cql.CassandraExceptionTranslator.translate(CassandraExceptionTranslator.java:139) ~[spring-data-cassandra-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.data.cassandra.core.cql.CassandraAccessor.translate(CassandraAccessor.java:334) ~[spring-data-cassandra-2.1.2.RELEASE.jar:2.1.2.RELEASE]
Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: Non-frozen collections are not allowed inside collections: map<text, map<text, text>>
at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:49) ~[cassandra-driver-core-3.6.0.jar:na]
Code
@Table
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class AssessmentSubmissionEntity implements Serializable {
@PrimaryKeyColumn(type = PrimaryKeyType.PARTITIONED)
private String studentId;
@PrimaryKeyColumn(type = PrimaryKeyType.PARTITIONED)
private String assessmentId;
@FrozenValue
@Column
private Map <String, Map<String, String>> values;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AssessmentSubmissionEntity that = (AssessmentSubmissionEntity) o;
return Objects.equals(studentId, that.studentId) &&
Objects.equals(assessmentId, that.assessmentId) &&
Objects.equals(values, that.values);
}
@Override
public int hashCode() {
return Objects.hash(studentId, assessmentId, values);
}
}
Maven
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-cassandra</artifactId>
<exclusions>
<exclusion>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-mapping</artifactId>
</dependency>
spring-boot cassandra
I have a springboot application which I hooked up with cassandra. I am trying to create a map inside a map but getting the below exception. Seems to me that even though I use @FrozenValue
, it is still sending the cal without the keyword frozen
Error
Caused by: org.springframework.data.cassandra.CassandraInvalidQueryException: Query; CQL [CREATE TABLE IF NOT EXISTS assessmentsubmissionentity (studentid text, assessmentid text, values map<text, map<text, text>>, PRIMARY KEY ((studentid, assessmentid)));]; Non-frozen collections are not allowed inside collections: map<text, map<text, text>>; nested exception is com.datastax.driver.core.exceptions.InvalidQueryException: Non-frozen collections are not allowed inside collections: map<text, map<text, text>>
at org.springframework.data.cassandra.core.cql.CassandraExceptionTranslator.translate(CassandraExceptionTranslator.java:139) ~[spring-data-cassandra-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.data.cassandra.core.cql.CassandraAccessor.translate(CassandraAccessor.java:334) ~[spring-data-cassandra-2.1.2.RELEASE.jar:2.1.2.RELEASE]
Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: Non-frozen collections are not allowed inside collections: map<text, map<text, text>>
at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:49) ~[cassandra-driver-core-3.6.0.jar:na]
Code
@Table
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class AssessmentSubmissionEntity implements Serializable {
@PrimaryKeyColumn(type = PrimaryKeyType.PARTITIONED)
private String studentId;
@PrimaryKeyColumn(type = PrimaryKeyType.PARTITIONED)
private String assessmentId;
@FrozenValue
@Column
private Map <String, Map<String, String>> values;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AssessmentSubmissionEntity that = (AssessmentSubmissionEntity) o;
return Objects.equals(studentId, that.studentId) &&
Objects.equals(assessmentId, that.assessmentId) &&
Objects.equals(values, that.values);
}
@Override
public int hashCode() {
return Objects.hash(studentId, assessmentId, values);
}
}
Maven
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-cassandra</artifactId>
<exclusions>
<exclusion>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-mapping</artifactId>
</dependency>
spring-boot cassandra
spring-boot cassandra
asked Nov 14 '18 at 6:38
user3310115
243311
243311
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
It's a problem with Spring Data for Cassandra - they don't have mapping for frozen collections. See DATACASS-465 in their JIRA - it was filed more than year ago, but there is no progress on it...
I think that only solution is to use Object Mapper from the DataStax's Java driver, or manage your tables via CQL.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53294412%2fspringboot-cassandra-frozen-value-not-recognised%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It's a problem with Spring Data for Cassandra - they don't have mapping for frozen collections. See DATACASS-465 in their JIRA - it was filed more than year ago, but there is no progress on it...
I think that only solution is to use Object Mapper from the DataStax's Java driver, or manage your tables via CQL.
add a comment |
It's a problem with Spring Data for Cassandra - they don't have mapping for frozen collections. See DATACASS-465 in their JIRA - it was filed more than year ago, but there is no progress on it...
I think that only solution is to use Object Mapper from the DataStax's Java driver, or manage your tables via CQL.
add a comment |
It's a problem with Spring Data for Cassandra - they don't have mapping for frozen collections. See DATACASS-465 in their JIRA - it was filed more than year ago, but there is no progress on it...
I think that only solution is to use Object Mapper from the DataStax's Java driver, or manage your tables via CQL.
It's a problem with Spring Data for Cassandra - they don't have mapping for frozen collections. See DATACASS-465 in their JIRA - it was filed more than year ago, but there is no progress on it...
I think that only solution is to use Object Mapper from the DataStax's Java driver, or manage your tables via CQL.
answered Nov 14 '18 at 8:26
Alex Ott
27.1k35072
27.1k35072
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53294412%2fspringboot-cassandra-frozen-value-not-recognised%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown