Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   * See the file LICENSE for redistribution information.
   * Copyright (c) 2002, 2013 Oracle and/or its affiliates.  All rights reserved.
  package com.sleepycat.persist.model;

The metadata for a secondary key field. A secondary key may be specified with the SecondaryKey annotation.

SecondaryKeyMetadata objects are thread-safe. Multiple threads may safely call the methods of a shared SecondaryKeyMetadata object.

Mark Hayes
 public class SecondaryKeyMetadata extends FieldMetadata {
     private static final long serialVersionUID = 8118924993396722502L;
     private String keyName;
     private Relationship relationship;
     private String elementClassName;
     private String relatedEntity;
     private DeleteAction deleteAction;

Used by an EntityModel to construct secondary key metadata.
     public SecondaryKeyMetadata(String name,
                                 String className,
                                 String declaringClassName,
                                 String elementClassName,
                                 String keyName,
                                 Relationship relationship,
                                 String relatedEntity,
                                 DeleteAction deleteAction) {
         this. = elementClassName;
         this. = keyName;
         this. = relationship;
         this. = relatedEntity;
         this. = deleteAction;

Returns the class name of the array or collection element for a Relationship.ONE_TO_MANY or Relationship.MANY_TO_MANY relationship, or null for a Relationship#ONE_TO_ONE ONE_TO_ONE} or MANY_TO_ONE relationship.
     public String getElementClassName() {
         return ;

Returns the key name, which may be different from the field name.
     public String getKeyName() {
         return ;

Returns the relationship between instances of the entity class and the secondary keys. This may be specified using the SecondaryKey.relate() annotation.
     public Relationship getRelationship() {
         return ;

Returns the class name of the related (foreign) entity, for which foreign key constraints are specified using the SecondaryKey.relatedEntity() annotation.
     public String getRelatedEntity() {
         return ;

Returns the action to take when a related entity is deleted having a primary key value that exists as a secondary key value for this entity. This may be specified using the SecondaryKey.onRelatedEntityDelete() annotation.
     public DeleteAction getDeleteAction() {
         return ;
     public boolean equals(Object other) {
         if (other instanceof SecondaryKeyMetadata) {
             SecondaryKeyMetadata o = (SecondaryKeyMetadataother;
             return super.equals(o) &&
                    == o.relationship &&
                   ClassMetadata.nullOrEqual(o.deleteAction) &&
                   ClassMetadata.nullOrEqual(o.keyName) &&
                                             o.elementClassName) &&
        } else {
            return false;
    public int hashCode() {
        return super.hashCode() +
               .hashCode() +
               ClassMetadata.hashCode() +
               ClassMetadata.hashCode() +
               ClassMetadata.hashCode() +
New to GrepCode? Check out our FAQ X