Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jnosql-dev] Have specific annotations to Entity

The goal of this issue is to allow specific domain entity to each NoSQL type. To solve this problem, I saw two options:

1 Allow the @Entity be extensible

Allows the @Entity be used in the other Annotation. Once this annotation applies the Entity, it has the same property of this Entity annotation.

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Stereotype
@Entity
public @interface CustomAnnotation {
    /**
     * The name of an entity. Defaults to the unqualified name of the entity class.
     * @return the entity name (Optional)
     */
    String value() default "";
}
@CustomAnnotation
public class Person {
//fields
}

So, will be an alias to:

@Entity
public class Person {
//fields
}

Conditions:

  • When there are two annotations that will use the Entity one.
  • Where there are two custom annotations then can use anyone.
  • When the custom annotation doesn't have a String value() default ""; it will use the Class.getSimpleName()
  • Where there is the method, that must use the same rule of the Entity

Adds four custom annotations kinds

  • ColumnFamily in the column API
  • DocumentCollection in the document API
  • Bucket in the key-value API
  • Vertex in the graph API

2 Add new annotations

Just add new annotations:

  • ColumnFamily in the column API
  • DocumentCollection in the document API
  • Bucket in the key-value API
  • Vertex in the graph API

3 keep what we have

The DDD fundamentals say:

An entity is an object fundamentally defined not by its attributes, but by a thread of continuity and identity.

Thereby, the concept is technology agnostic



Ref: https://github.com/eclipse/jnosql-artemis/issues/41
--
Otávio Gonçalves de Santana

Back to the top