All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.neo4j.ogm.annotation.Index Maven / Gradle / Ivy

There is a newer version: 4.0.11
Show newest version
/*
 * Copyright (c) 2002-2016 "Neo Technology,"
 * Network Engine for Objects in Lund AB [http://neotechnology.com]
 *
 * This product is licensed to you under the Apache License, Version 2.0 (the "License").
 * You may not use this product except in compliance with the License.
 *
 * This product may include a number of subcomponents with
 * separate copyright notices and license terms. Your use of the source
 * code for these subcomponents is subject to the terms and
 *  conditions of the subcomponent's license, as noted in the LICENSE file.
 */
package org.neo4j.ogm.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Fields and properties marked with this annotation will notify the OGM that they
 * should be used as part of an index and/or for use during lookups and merging.
 *
 * Fields marked with unique=false and primary=true will be ignored.
 *
 * Only one index per class hierarchy may be marked as primary.
 *
 * If index auto generation is turned on then classes containing @Index
 * will be used. Indexes will always be generated with the containing class's label and
 * the annotated property's name.
 *
 * Index generation behaviour can be defined in ogm.properties by
 * defining a property called: indexes.auto and providing
 * a value of:
 * 
    *
  • assert: drop all indexes and constraints then create * constraints and indexes on startup. No indexes or constraints will be dropped on * shutdown.
  • *
  • validate: confirm that the required indexes and constraints * defined already exist on startup otherwise abort startup
  • *
  • dump: will generate a file in the current directory with the * cypher commands to create indexes and constraints. Before doing this it will run the * same behaviour as validate.
  • *
  • none: do not generate any constraints or indexes * [default]
  • *
* * @author Mark Angrish */ @Retention(RetentionPolicy.RUNTIME) @Target(value = ElementType.FIELD) public @interface Index { /** * Indicates whether to apply a unique constraint on this property, defaults to * false. */ boolean unique() default false; /** * Indicates this constraint (unique index) should be used as the key for merges and loading by id. */ boolean primary() default false; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy