1

i want to add index in map attribute i doen't have any idea about adding index in map attribute

i have refer objectdb site link but i doesn't find soultion @index is enough for added index

for example:

@Entity
@Table(name = Customer.TABLE_NAME)
public class Country {

    @index
    @OneToMany(fetch = FetchType.LAZY)
    @JoinTable(name = Country.TABLE_TRANSLATION_NAME,
        joinColumns = @JoinColumn(name = Country.TABLE_NAME),
        inverseJoinColumns = @JoinColumn(name = NameTranslation.TABLE_NAME))
    @MapKeyJoinColumn(name = Language.TABLE_NAME)
    private Map<Language, NameTranslation> names;

}

language and nametranslation has seperate entity

jmvivo
  • 2,653
  • 1
  • 16
  • 20
ASHISH
  • 45
  • 1
  • 6

1 Answers1

0

See this forum thread on ObjectDB website regarding indexing map keys, and this forum thread about indexing map values.

You can set an index on keys using the @Key(index="true") annotation, and on values using the @Value(index="true") annotation, but as explained above, an index on keys will not be useful in queries in the current ObjectDB version (2.5.7).

ObjectDB
  • 1,312
  • 8
  • 9
  • what should i do for map attribute adding index ?@Key(index="true") just like befor e attribute or any thing else i need to add – ASHISH Oct 16 '14 at 04:05
  • Don't use @Key(index="true"). Please read the referenced forum threads in the answer. Index on map keys are currently not supported. See the workaround in the forum post. – ObjectDB Oct 16 '14 at 19:57