How to register custom property type to xodus `PersistentEntityStore`












3















I'm working with xodus database and I want to store java.time.Instant as property of my model object (Diary) so I implemented InstantBinding.



Next in repository object that I created to work with my Diary objects I registered InstantBindig in save and load methods of repository because PersistentEntityStore.registerCustomPropertyType(@NotNull final StoreTransaction txn, @NotNull final Class<? extends Comparable> clazz,@NotNull final ComparableBinding binding); needs StoreTransaction txn input.
and then when I'm using the repository I get this exception:



Exception in thread "JavaFX Application Thread" jetbrains.exodus.entitystore.EntityStoreException: Already registered property type id 9
at jetbrains.exodus.entitystore.tables.PropertyTypes.registerCustomPropertyType(PropertyTypes.java:77)
at jetbrains.exodus.entitystore.PersistentEntityStoreImpl.registerCustomPropertyType(PersistentEntityStoreImpl.java:520)
at io.github.mojtab23.diaries.DiaryRepository.lambda$saveDiary$0(DiaryRepository.java:35)
at jetbrains.exodus.entitystore.PersistentEntityStoreImpl.executeInTransaction(PersistentEntityStoreImpl.java:529)
at io.github.mojtab23.diaries.DiaryRepository.saveDiary(DiaryRepository.java:34)
at io.github.mojtab23.diaries.DiariesView.saveChanges(DiariesView.java:222)
at io.github.mojtab23.diaries.DiariesView.lambda$buildDiaryEditor$6(DiariesView.java:203)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Node.fireEvent(Node.java:8413)
at javafx.scene.control.Button.fire(Button.java:185)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:381)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$354(GlassViewEventHandler.java:417)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:416)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)


So what is the right way of registering custom property type to xodus?



here is my classes:



Diary:



import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import jetbrains.exodus.entitystore.EntityId;

public class Diary implements Cloneable {

private final ObjectProperty<Instant> timestamp;
private final StringProperty text;
private EntityId id;

public Diary() {
this.text = new SimpleStringProperty();
timestamp = new SimpleObjectProperty<>(Instant.now());
}

public Diary(String text, Instant time) {
this.text = new SimpleStringProperty(text);
timestamp = new SimpleObjectProperty<>(time);

}

public Diary(SimpleObjectProperty<Instant> timestamp, StringProperty text, EntityId id) {
this.timestamp = timestamp;
this.text = text;
this.id = id;
}

public EntityId getId() {
return id;
}

public void setId(EntityId id) {
this.id = id;
}

public Instant getTimestamp() {
return timestamp.get();
}

public void setTimestamp(Instant timestamp) {
this.timestamp.set(timestamp);
}

public ObjectProperty<Instant> timestampProperty() {
return timestamp;
}

public String getText() {
return text.get();
}

public void setText(String text) {
this.text.set(text);
}

public StringProperty textProperty() {
return text;
}

@Override
public String toString() {
return "Diary{" +
"id=" + id +
", timestamp=" + timestamp +
", text=" + text +
'}';
}

@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
}


DiaryRepository:



import io.github.mojtab23.diaries.model.diary.Diary;
import jetbrains.exodus.entitystore.*;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import javax.annotation.PreDestroy;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;



@Repository
public class DiaryRepository {
private static final Logger LOGGER = LoggerFactory.getLogger(DiaryRepository.class);

private final PersistentEntityStore entityStore;
private final String entityType = "Diary";

public DiaryRepository() {
entityStore = PersistentEntityStores.newInstance(".DiariesAppData");


}


public void saveDiary(final Diary diary) {
entityStore.executeInTransaction((StoreTransaction txn) -> {
entityStore.registerCustomPropertyType(txn, Instant.class, InstantBinding.BINDING);

diaryToEntity(diary, txn);
});

}

public Entity diaryToEntity(final Diary diary, final StoreTransaction txn) {

final Entity diaryEntity = txn.newEntity(entityType);
diaryEntity.setProperty("text", diary.getText());

diaryEntity.setProperty("timestamp", diary.getTimestamp());
return diaryEntity;
}


public Diary entityToDiary(final Entity entity, final StoreTransaction txn) {


final @Nullable String text = (String) entity.getProperty("text");
final @Nullable Instant timestamp = (Instant) entity.getProperty("timestamp");

if (text != null) {
if (timestamp != null) {
return new Diary(text, timestamp);
} else
return new Diary(text, Instant.MIN);
}
return null;
}

public List<Diary> readAllDiaries() {

return entityStore.computeInReadonlyTransaction(txn -> {
entityStore.registerCustomPropertyType(txn, Instant.class, InstantBinding.BINDING);

final EntityIterable allDiaries = txn.getAll(entityType);
final List<Diary> diaryList = new ArrayList<>();
allDiaries.forEach(entity -> {
final Diary e = entityToDiary(entity, txn);
if (e != null) {
diaryList.add(e);
}
});
LOGGER.warn("Number of Diaries: " + diaryList.size());
return diaryList;

});

}

public void deleteAll() {

entityStore.executeInTransaction(txn -> {


txn.getAll(entityType).forEach(entity ->
{
if (!entity.delete()) {
LOGGER.warn("cant delete {}", entityToDiary(entity, txn));
}
});
});

}


@PreDestroy
public void atEnd() {
entityStore.close();
}

}


InstantBinding:



import jetbrains.exodus.ArrayByteIterable;
import jetbrains.exodus.ByteIterable;
import jetbrains.exodus.bindings.BindingUtils;
import jetbrains.exodus.bindings.ComparableBinding;
import jetbrains.exodus.util.LightOutputStream;
import org.jetbrains.annotations.NotNull;

import java.io.ByteArrayInputStream;
import java.time.Instant;

public class InstantBinding extends ComparableBinding {

public static final InstantBinding BINDING = new InstantBinding();

public static Instant entryToInstant(@NotNull final ByteIterable entry) {
return (Instant) BINDING.entryToObject(entry);
}

public static ArrayByteIterable instantToEntry(final Instant object) {
return BINDING.objectToEntry(object);
}

@Override
public Comparable readObject(@NotNull ByteArrayInputStream stream) {
final long l = BindingUtils.readLong(stream);
final int i = BindingUtils.readInt(stream);
return Instant.ofEpochSecond(l, i);
}

@Override
public void writeObject(@NotNull LightOutputStream output, @NotNull Comparable object) {
final Instant instant = (Instant) object;
output.writeUnsignedLong(instant.getEpochSecond() ^ 0x8000000000000000L);
output.writeUnsignedInt(instant.getNano() ^ 0x80000000);

}

}









share|improve this question























  • Does DiariesView#saveChanges() create a transaction?

    – Vyacheslav Lukianov
    May 22 '17 at 15:40











  • @vyacheslav-lukianov transacction will be created in DiaryRepository.saveDiarymethod. I don't know why registerCustomPropertyType needs transaction as parameter?!

    – mojtab23
    May 22 '17 at 18:53


















3















I'm working with xodus database and I want to store java.time.Instant as property of my model object (Diary) so I implemented InstantBinding.



Next in repository object that I created to work with my Diary objects I registered InstantBindig in save and load methods of repository because PersistentEntityStore.registerCustomPropertyType(@NotNull final StoreTransaction txn, @NotNull final Class<? extends Comparable> clazz,@NotNull final ComparableBinding binding); needs StoreTransaction txn input.
and then when I'm using the repository I get this exception:



Exception in thread "JavaFX Application Thread" jetbrains.exodus.entitystore.EntityStoreException: Already registered property type id 9
at jetbrains.exodus.entitystore.tables.PropertyTypes.registerCustomPropertyType(PropertyTypes.java:77)
at jetbrains.exodus.entitystore.PersistentEntityStoreImpl.registerCustomPropertyType(PersistentEntityStoreImpl.java:520)
at io.github.mojtab23.diaries.DiaryRepository.lambda$saveDiary$0(DiaryRepository.java:35)
at jetbrains.exodus.entitystore.PersistentEntityStoreImpl.executeInTransaction(PersistentEntityStoreImpl.java:529)
at io.github.mojtab23.diaries.DiaryRepository.saveDiary(DiaryRepository.java:34)
at io.github.mojtab23.diaries.DiariesView.saveChanges(DiariesView.java:222)
at io.github.mojtab23.diaries.DiariesView.lambda$buildDiaryEditor$6(DiariesView.java:203)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Node.fireEvent(Node.java:8413)
at javafx.scene.control.Button.fire(Button.java:185)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:381)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$354(GlassViewEventHandler.java:417)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:416)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)


So what is the right way of registering custom property type to xodus?



here is my classes:



Diary:



import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import jetbrains.exodus.entitystore.EntityId;

public class Diary implements Cloneable {

private final ObjectProperty<Instant> timestamp;
private final StringProperty text;
private EntityId id;

public Diary() {
this.text = new SimpleStringProperty();
timestamp = new SimpleObjectProperty<>(Instant.now());
}

public Diary(String text, Instant time) {
this.text = new SimpleStringProperty(text);
timestamp = new SimpleObjectProperty<>(time);

}

public Diary(SimpleObjectProperty<Instant> timestamp, StringProperty text, EntityId id) {
this.timestamp = timestamp;
this.text = text;
this.id = id;
}

public EntityId getId() {
return id;
}

public void setId(EntityId id) {
this.id = id;
}

public Instant getTimestamp() {
return timestamp.get();
}

public void setTimestamp(Instant timestamp) {
this.timestamp.set(timestamp);
}

public ObjectProperty<Instant> timestampProperty() {
return timestamp;
}

public String getText() {
return text.get();
}

public void setText(String text) {
this.text.set(text);
}

public StringProperty textProperty() {
return text;
}

@Override
public String toString() {
return "Diary{" +
"id=" + id +
", timestamp=" + timestamp +
", text=" + text +
'}';
}

@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
}


DiaryRepository:



import io.github.mojtab23.diaries.model.diary.Diary;
import jetbrains.exodus.entitystore.*;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import javax.annotation.PreDestroy;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;



@Repository
public class DiaryRepository {
private static final Logger LOGGER = LoggerFactory.getLogger(DiaryRepository.class);

private final PersistentEntityStore entityStore;
private final String entityType = "Diary";

public DiaryRepository() {
entityStore = PersistentEntityStores.newInstance(".DiariesAppData");


}


public void saveDiary(final Diary diary) {
entityStore.executeInTransaction((StoreTransaction txn) -> {
entityStore.registerCustomPropertyType(txn, Instant.class, InstantBinding.BINDING);

diaryToEntity(diary, txn);
});

}

public Entity diaryToEntity(final Diary diary, final StoreTransaction txn) {

final Entity diaryEntity = txn.newEntity(entityType);
diaryEntity.setProperty("text", diary.getText());

diaryEntity.setProperty("timestamp", diary.getTimestamp());
return diaryEntity;
}


public Diary entityToDiary(final Entity entity, final StoreTransaction txn) {


final @Nullable String text = (String) entity.getProperty("text");
final @Nullable Instant timestamp = (Instant) entity.getProperty("timestamp");

if (text != null) {
if (timestamp != null) {
return new Diary(text, timestamp);
} else
return new Diary(text, Instant.MIN);
}
return null;
}

public List<Diary> readAllDiaries() {

return entityStore.computeInReadonlyTransaction(txn -> {
entityStore.registerCustomPropertyType(txn, Instant.class, InstantBinding.BINDING);

final EntityIterable allDiaries = txn.getAll(entityType);
final List<Diary> diaryList = new ArrayList<>();
allDiaries.forEach(entity -> {
final Diary e = entityToDiary(entity, txn);
if (e != null) {
diaryList.add(e);
}
});
LOGGER.warn("Number of Diaries: " + diaryList.size());
return diaryList;

});

}

public void deleteAll() {

entityStore.executeInTransaction(txn -> {


txn.getAll(entityType).forEach(entity ->
{
if (!entity.delete()) {
LOGGER.warn("cant delete {}", entityToDiary(entity, txn));
}
});
});

}


@PreDestroy
public void atEnd() {
entityStore.close();
}

}


InstantBinding:



import jetbrains.exodus.ArrayByteIterable;
import jetbrains.exodus.ByteIterable;
import jetbrains.exodus.bindings.BindingUtils;
import jetbrains.exodus.bindings.ComparableBinding;
import jetbrains.exodus.util.LightOutputStream;
import org.jetbrains.annotations.NotNull;

import java.io.ByteArrayInputStream;
import java.time.Instant;

public class InstantBinding extends ComparableBinding {

public static final InstantBinding BINDING = new InstantBinding();

public static Instant entryToInstant(@NotNull final ByteIterable entry) {
return (Instant) BINDING.entryToObject(entry);
}

public static ArrayByteIterable instantToEntry(final Instant object) {
return BINDING.objectToEntry(object);
}

@Override
public Comparable readObject(@NotNull ByteArrayInputStream stream) {
final long l = BindingUtils.readLong(stream);
final int i = BindingUtils.readInt(stream);
return Instant.ofEpochSecond(l, i);
}

@Override
public void writeObject(@NotNull LightOutputStream output, @NotNull Comparable object) {
final Instant instant = (Instant) object;
output.writeUnsignedLong(instant.getEpochSecond() ^ 0x8000000000000000L);
output.writeUnsignedInt(instant.getNano() ^ 0x80000000);

}

}









share|improve this question























  • Does DiariesView#saveChanges() create a transaction?

    – Vyacheslav Lukianov
    May 22 '17 at 15:40











  • @vyacheslav-lukianov transacction will be created in DiaryRepository.saveDiarymethod. I don't know why registerCustomPropertyType needs transaction as parameter?!

    – mojtab23
    May 22 '17 at 18:53
















3












3








3








I'm working with xodus database and I want to store java.time.Instant as property of my model object (Diary) so I implemented InstantBinding.



Next in repository object that I created to work with my Diary objects I registered InstantBindig in save and load methods of repository because PersistentEntityStore.registerCustomPropertyType(@NotNull final StoreTransaction txn, @NotNull final Class<? extends Comparable> clazz,@NotNull final ComparableBinding binding); needs StoreTransaction txn input.
and then when I'm using the repository I get this exception:



Exception in thread "JavaFX Application Thread" jetbrains.exodus.entitystore.EntityStoreException: Already registered property type id 9
at jetbrains.exodus.entitystore.tables.PropertyTypes.registerCustomPropertyType(PropertyTypes.java:77)
at jetbrains.exodus.entitystore.PersistentEntityStoreImpl.registerCustomPropertyType(PersistentEntityStoreImpl.java:520)
at io.github.mojtab23.diaries.DiaryRepository.lambda$saveDiary$0(DiaryRepository.java:35)
at jetbrains.exodus.entitystore.PersistentEntityStoreImpl.executeInTransaction(PersistentEntityStoreImpl.java:529)
at io.github.mojtab23.diaries.DiaryRepository.saveDiary(DiaryRepository.java:34)
at io.github.mojtab23.diaries.DiariesView.saveChanges(DiariesView.java:222)
at io.github.mojtab23.diaries.DiariesView.lambda$buildDiaryEditor$6(DiariesView.java:203)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Node.fireEvent(Node.java:8413)
at javafx.scene.control.Button.fire(Button.java:185)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:381)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$354(GlassViewEventHandler.java:417)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:416)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)


So what is the right way of registering custom property type to xodus?



here is my classes:



Diary:



import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import jetbrains.exodus.entitystore.EntityId;

public class Diary implements Cloneable {

private final ObjectProperty<Instant> timestamp;
private final StringProperty text;
private EntityId id;

public Diary() {
this.text = new SimpleStringProperty();
timestamp = new SimpleObjectProperty<>(Instant.now());
}

public Diary(String text, Instant time) {
this.text = new SimpleStringProperty(text);
timestamp = new SimpleObjectProperty<>(time);

}

public Diary(SimpleObjectProperty<Instant> timestamp, StringProperty text, EntityId id) {
this.timestamp = timestamp;
this.text = text;
this.id = id;
}

public EntityId getId() {
return id;
}

public void setId(EntityId id) {
this.id = id;
}

public Instant getTimestamp() {
return timestamp.get();
}

public void setTimestamp(Instant timestamp) {
this.timestamp.set(timestamp);
}

public ObjectProperty<Instant> timestampProperty() {
return timestamp;
}

public String getText() {
return text.get();
}

public void setText(String text) {
this.text.set(text);
}

public StringProperty textProperty() {
return text;
}

@Override
public String toString() {
return "Diary{" +
"id=" + id +
", timestamp=" + timestamp +
", text=" + text +
'}';
}

@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
}


DiaryRepository:



import io.github.mojtab23.diaries.model.diary.Diary;
import jetbrains.exodus.entitystore.*;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import javax.annotation.PreDestroy;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;



@Repository
public class DiaryRepository {
private static final Logger LOGGER = LoggerFactory.getLogger(DiaryRepository.class);

private final PersistentEntityStore entityStore;
private final String entityType = "Diary";

public DiaryRepository() {
entityStore = PersistentEntityStores.newInstance(".DiariesAppData");


}


public void saveDiary(final Diary diary) {
entityStore.executeInTransaction((StoreTransaction txn) -> {
entityStore.registerCustomPropertyType(txn, Instant.class, InstantBinding.BINDING);

diaryToEntity(diary, txn);
});

}

public Entity diaryToEntity(final Diary diary, final StoreTransaction txn) {

final Entity diaryEntity = txn.newEntity(entityType);
diaryEntity.setProperty("text", diary.getText());

diaryEntity.setProperty("timestamp", diary.getTimestamp());
return diaryEntity;
}


public Diary entityToDiary(final Entity entity, final StoreTransaction txn) {


final @Nullable String text = (String) entity.getProperty("text");
final @Nullable Instant timestamp = (Instant) entity.getProperty("timestamp");

if (text != null) {
if (timestamp != null) {
return new Diary(text, timestamp);
} else
return new Diary(text, Instant.MIN);
}
return null;
}

public List<Diary> readAllDiaries() {

return entityStore.computeInReadonlyTransaction(txn -> {
entityStore.registerCustomPropertyType(txn, Instant.class, InstantBinding.BINDING);

final EntityIterable allDiaries = txn.getAll(entityType);
final List<Diary> diaryList = new ArrayList<>();
allDiaries.forEach(entity -> {
final Diary e = entityToDiary(entity, txn);
if (e != null) {
diaryList.add(e);
}
});
LOGGER.warn("Number of Diaries: " + diaryList.size());
return diaryList;

});

}

public void deleteAll() {

entityStore.executeInTransaction(txn -> {


txn.getAll(entityType).forEach(entity ->
{
if (!entity.delete()) {
LOGGER.warn("cant delete {}", entityToDiary(entity, txn));
}
});
});

}


@PreDestroy
public void atEnd() {
entityStore.close();
}

}


InstantBinding:



import jetbrains.exodus.ArrayByteIterable;
import jetbrains.exodus.ByteIterable;
import jetbrains.exodus.bindings.BindingUtils;
import jetbrains.exodus.bindings.ComparableBinding;
import jetbrains.exodus.util.LightOutputStream;
import org.jetbrains.annotations.NotNull;

import java.io.ByteArrayInputStream;
import java.time.Instant;

public class InstantBinding extends ComparableBinding {

public static final InstantBinding BINDING = new InstantBinding();

public static Instant entryToInstant(@NotNull final ByteIterable entry) {
return (Instant) BINDING.entryToObject(entry);
}

public static ArrayByteIterable instantToEntry(final Instant object) {
return BINDING.objectToEntry(object);
}

@Override
public Comparable readObject(@NotNull ByteArrayInputStream stream) {
final long l = BindingUtils.readLong(stream);
final int i = BindingUtils.readInt(stream);
return Instant.ofEpochSecond(l, i);
}

@Override
public void writeObject(@NotNull LightOutputStream output, @NotNull Comparable object) {
final Instant instant = (Instant) object;
output.writeUnsignedLong(instant.getEpochSecond() ^ 0x8000000000000000L);
output.writeUnsignedInt(instant.getNano() ^ 0x80000000);

}

}









share|improve this question














I'm working with xodus database and I want to store java.time.Instant as property of my model object (Diary) so I implemented InstantBinding.



Next in repository object that I created to work with my Diary objects I registered InstantBindig in save and load methods of repository because PersistentEntityStore.registerCustomPropertyType(@NotNull final StoreTransaction txn, @NotNull final Class<? extends Comparable> clazz,@NotNull final ComparableBinding binding); needs StoreTransaction txn input.
and then when I'm using the repository I get this exception:



Exception in thread "JavaFX Application Thread" jetbrains.exodus.entitystore.EntityStoreException: Already registered property type id 9
at jetbrains.exodus.entitystore.tables.PropertyTypes.registerCustomPropertyType(PropertyTypes.java:77)
at jetbrains.exodus.entitystore.PersistentEntityStoreImpl.registerCustomPropertyType(PersistentEntityStoreImpl.java:520)
at io.github.mojtab23.diaries.DiaryRepository.lambda$saveDiary$0(DiaryRepository.java:35)
at jetbrains.exodus.entitystore.PersistentEntityStoreImpl.executeInTransaction(PersistentEntityStoreImpl.java:529)
at io.github.mojtab23.diaries.DiaryRepository.saveDiary(DiaryRepository.java:34)
at io.github.mojtab23.diaries.DiariesView.saveChanges(DiariesView.java:222)
at io.github.mojtab23.diaries.DiariesView.lambda$buildDiaryEditor$6(DiariesView.java:203)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Node.fireEvent(Node.java:8413)
at javafx.scene.control.Button.fire(Button.java:185)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:381)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$354(GlassViewEventHandler.java:417)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:416)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)


So what is the right way of registering custom property type to xodus?



here is my classes:



Diary:



import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import jetbrains.exodus.entitystore.EntityId;

public class Diary implements Cloneable {

private final ObjectProperty<Instant> timestamp;
private final StringProperty text;
private EntityId id;

public Diary() {
this.text = new SimpleStringProperty();
timestamp = new SimpleObjectProperty<>(Instant.now());
}

public Diary(String text, Instant time) {
this.text = new SimpleStringProperty(text);
timestamp = new SimpleObjectProperty<>(time);

}

public Diary(SimpleObjectProperty<Instant> timestamp, StringProperty text, EntityId id) {
this.timestamp = timestamp;
this.text = text;
this.id = id;
}

public EntityId getId() {
return id;
}

public void setId(EntityId id) {
this.id = id;
}

public Instant getTimestamp() {
return timestamp.get();
}

public void setTimestamp(Instant timestamp) {
this.timestamp.set(timestamp);
}

public ObjectProperty<Instant> timestampProperty() {
return timestamp;
}

public String getText() {
return text.get();
}

public void setText(String text) {
this.text.set(text);
}

public StringProperty textProperty() {
return text;
}

@Override
public String toString() {
return "Diary{" +
"id=" + id +
", timestamp=" + timestamp +
", text=" + text +
'}';
}

@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
}


DiaryRepository:



import io.github.mojtab23.diaries.model.diary.Diary;
import jetbrains.exodus.entitystore.*;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import javax.annotation.PreDestroy;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;



@Repository
public class DiaryRepository {
private static final Logger LOGGER = LoggerFactory.getLogger(DiaryRepository.class);

private final PersistentEntityStore entityStore;
private final String entityType = "Diary";

public DiaryRepository() {
entityStore = PersistentEntityStores.newInstance(".DiariesAppData");


}


public void saveDiary(final Diary diary) {
entityStore.executeInTransaction((StoreTransaction txn) -> {
entityStore.registerCustomPropertyType(txn, Instant.class, InstantBinding.BINDING);

diaryToEntity(diary, txn);
});

}

public Entity diaryToEntity(final Diary diary, final StoreTransaction txn) {

final Entity diaryEntity = txn.newEntity(entityType);
diaryEntity.setProperty("text", diary.getText());

diaryEntity.setProperty("timestamp", diary.getTimestamp());
return diaryEntity;
}


public Diary entityToDiary(final Entity entity, final StoreTransaction txn) {


final @Nullable String text = (String) entity.getProperty("text");
final @Nullable Instant timestamp = (Instant) entity.getProperty("timestamp");

if (text != null) {
if (timestamp != null) {
return new Diary(text, timestamp);
} else
return new Diary(text, Instant.MIN);
}
return null;
}

public List<Diary> readAllDiaries() {

return entityStore.computeInReadonlyTransaction(txn -> {
entityStore.registerCustomPropertyType(txn, Instant.class, InstantBinding.BINDING);

final EntityIterable allDiaries = txn.getAll(entityType);
final List<Diary> diaryList = new ArrayList<>();
allDiaries.forEach(entity -> {
final Diary e = entityToDiary(entity, txn);
if (e != null) {
diaryList.add(e);
}
});
LOGGER.warn("Number of Diaries: " + diaryList.size());
return diaryList;

});

}

public void deleteAll() {

entityStore.executeInTransaction(txn -> {


txn.getAll(entityType).forEach(entity ->
{
if (!entity.delete()) {
LOGGER.warn("cant delete {}", entityToDiary(entity, txn));
}
});
});

}


@PreDestroy
public void atEnd() {
entityStore.close();
}

}


InstantBinding:



import jetbrains.exodus.ArrayByteIterable;
import jetbrains.exodus.ByteIterable;
import jetbrains.exodus.bindings.BindingUtils;
import jetbrains.exodus.bindings.ComparableBinding;
import jetbrains.exodus.util.LightOutputStream;
import org.jetbrains.annotations.NotNull;

import java.io.ByteArrayInputStream;
import java.time.Instant;

public class InstantBinding extends ComparableBinding {

public static final InstantBinding BINDING = new InstantBinding();

public static Instant entryToInstant(@NotNull final ByteIterable entry) {
return (Instant) BINDING.entryToObject(entry);
}

public static ArrayByteIterable instantToEntry(final Instant object) {
return BINDING.objectToEntry(object);
}

@Override
public Comparable readObject(@NotNull ByteArrayInputStream stream) {
final long l = BindingUtils.readLong(stream);
final int i = BindingUtils.readInt(stream);
return Instant.ofEpochSecond(l, i);
}

@Override
public void writeObject(@NotNull LightOutputStream output, @NotNull Comparable object) {
final Instant instant = (Instant) object;
output.writeUnsignedLong(instant.getEpochSecond() ^ 0x8000000000000000L);
output.writeUnsignedInt(instant.getNano() ^ 0x80000000);

}

}






java xodus






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked May 22 '17 at 11:29









mojtab23mojtab23

6831924




6831924













  • Does DiariesView#saveChanges() create a transaction?

    – Vyacheslav Lukianov
    May 22 '17 at 15:40











  • @vyacheslav-lukianov transacction will be created in DiaryRepository.saveDiarymethod. I don't know why registerCustomPropertyType needs transaction as parameter?!

    – mojtab23
    May 22 '17 at 18:53





















  • Does DiariesView#saveChanges() create a transaction?

    – Vyacheslav Lukianov
    May 22 '17 at 15:40











  • @vyacheslav-lukianov transacction will be created in DiaryRepository.saveDiarymethod. I don't know why registerCustomPropertyType needs transaction as parameter?!

    – mojtab23
    May 22 '17 at 18:53



















Does DiariesView#saveChanges() create a transaction?

– Vyacheslav Lukianov
May 22 '17 at 15:40





Does DiariesView#saveChanges() create a transaction?

– Vyacheslav Lukianov
May 22 '17 at 15:40













@vyacheslav-lukianov transacction will be created in DiaryRepository.saveDiarymethod. I don't know why registerCustomPropertyType needs transaction as parameter?!

– mojtab23
May 22 '17 at 18:53







@vyacheslav-lukianov transacction will be created in DiaryRepository.saveDiarymethod. I don't know why registerCustomPropertyType needs transaction as parameter?!

– mojtab23
May 22 '17 at 18:53














1 Answer
1






active

oldest

votes


















2














It seems you are experiencing this bug. It's already fixed, the fix will be available in the version 1.0.6. Currently there are two workarounds:




  1. Surround the PersistentEntityStore.registerCustomPropertyType() call with try-catch block, catch EntityStoreException and ignore it. When the next release (1.0.6) is available make your project depending on it, and remove the try-catch block.

  2. Set your project depending on the 1.0.6-SNAPSHOT version published to the Sonartype snapshots repository.






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44111734%2fhow-to-register-custom-property-type-to-xodus-persistententitystore%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    It seems you are experiencing this bug. It's already fixed, the fix will be available in the version 1.0.6. Currently there are two workarounds:




    1. Surround the PersistentEntityStore.registerCustomPropertyType() call with try-catch block, catch EntityStoreException and ignore it. When the next release (1.0.6) is available make your project depending on it, and remove the try-catch block.

    2. Set your project depending on the 1.0.6-SNAPSHOT version published to the Sonartype snapshots repository.






    share|improve this answer






























      2














      It seems you are experiencing this bug. It's already fixed, the fix will be available in the version 1.0.6. Currently there are two workarounds:




      1. Surround the PersistentEntityStore.registerCustomPropertyType() call with try-catch block, catch EntityStoreException and ignore it. When the next release (1.0.6) is available make your project depending on it, and remove the try-catch block.

      2. Set your project depending on the 1.0.6-SNAPSHOT version published to the Sonartype snapshots repository.






      share|improve this answer




























        2












        2








        2







        It seems you are experiencing this bug. It's already fixed, the fix will be available in the version 1.0.6. Currently there are two workarounds:




        1. Surround the PersistentEntityStore.registerCustomPropertyType() call with try-catch block, catch EntityStoreException and ignore it. When the next release (1.0.6) is available make your project depending on it, and remove the try-catch block.

        2. Set your project depending on the 1.0.6-SNAPSHOT version published to the Sonartype snapshots repository.






        share|improve this answer















        It seems you are experiencing this bug. It's already fixed, the fix will be available in the version 1.0.6. Currently there are two workarounds:




        1. Surround the PersistentEntityStore.registerCustomPropertyType() call with try-catch block, catch EntityStoreException and ignore it. When the next release (1.0.6) is available make your project depending on it, and remove the try-catch block.

        2. Set your project depending on the 1.0.6-SNAPSHOT version published to the Sonartype snapshots repository.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 1 at 11:50









        Danny MacMillan

        232




        232










        answered May 22 '17 at 20:13









        Vyacheslav LukianovVyacheslav Lukianov

        91847




        91847
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44111734%2fhow-to-register-custom-property-type-to-xodus-persistententitystore%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith