Note that there are some explanatory texts on larger screens.

plurals
  1. POFrom JPA to NOSQL
    primarykey
    data
    text
    <p><br> I am trying to add a NOSQL data into my JPA-based application, following <a href="http://static.springsource.org/spring-data/data-graph/snapshot-site/reference/html/#cross-store" rel="nofollow">this tutorial</a>.<br> The entity I want to add, was befored modeled without NOSQL in this way: </p> <p><strong>Triple.java</strong></p> <pre><code>@Entity @IdClass(ConceptPk.class) @Table(name = "triple") public class TripleDBModel { protected List&lt;Annotation&gt; annotations; public Concept conceptUriSubject; public Concept conceptUriObject; public Concept conceptUriPredicate; @ManyToMany( cascade={CascadeType.ALL }, fetch=FetchType.LAZY ) @JoinTable(name = "triple_has_annotation", joinColumns={@JoinColumn(name="uri_concept_subject"), @JoinColumn(name="uri_concept_object"), @JoinColumn(name="uri_concept_predicate") }, inverseJoinColumns=@JoinColumn(name="annotation_id") ) public List&lt;Annotation&gt; getAnnotations() { return annotations; } public void setAnnotations(List&lt;Annotation&gt; annotations) { this.annotations = annotations; } </code></pre> <p><strong>ConceptPk.java</strong> </p> <pre><code>@Embeddable public class ConceptPk implements java.io.Serializable { private static final long serialVersionUID = 1L; public Concept conceptUriSubject; public Concept conceptUriObject; public Concept conceptUriPredicate; @Id @ManyToOne(cascade=CascadeType.MERGE) @JoinColumn(name="uri_concept_subject") public Concept getConceptUriSubject() { return conceptUriSubject; } public void setConceptUriSubject(Concept conceptUriSubject) { this.conceptUriSubject = conceptUriSubject; } </code></pre> <p>I am omiting repetitions, but the 3 <code>Concept</code>s are part of the primary key, of the @Id.<br> Adapting this entity to NOSQL: </p> <pre><code>@Entity @IdClass(ConceptPk.class) @Table(name = "triple") @NodeEntity(partial = true) public class TripleDBModel { //Fields referring other entities shouldn't be initialized protected List&lt;Annotation&gt; annotations; //public Concept conceptUriSubject; //public Concept conceptUriObject; //public Concept conceptUriPredicate; @RelatedTo(type = "conceptUriSubject", elementClass = Concept.class) Set&lt;Concept&gt; conceptUriSubject; </code></pre> <p>Now the question, which actually are two questions: </p> <p>A) <code>@RelatedTo(type = "conceptUriSubject", elementClass = Concept.class)</code> gives me error on Eclipse, and advises me to add a cast, but this doesn't solve the error. I don't know if I must an annotation or any other additional thing to <code>Class.java</code> </p> <p>B) As I have specified, the primery key is composed by 3 concepts, and <code>ConceptPK.java</code> is required. JPA modelling is ok, but I don't know how to do the same in NOSQL</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload