Skip to content

Commit

Permalink
Merge pull request #238 from JetBrains/ytdb-226-entity-renew
Browse files Browse the repository at this point in the history
Generate id method was fixed.
  • Loading branch information
andrii0lomakin authored Jan 16, 2025
2 parents 591031f + f7aac0f commit 5877618
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ import com.jetbrains.youtrack.db.internal.core.id.RecordId
import com.jetbrains.youtrack.db.internal.core.record.RecordAbstract
import com.jetbrains.youtrack.db.internal.core.record.impl.RecordBytes
import jetbrains.exodus.ByteIterable
import jetbrains.exodus.entitystore.Entity
import jetbrains.exodus.entitystore.EntityId
import jetbrains.exodus.entitystore.EntityIterable
import jetbrains.exodus.entitystore.EntityRemovedInDatabaseException
import jetbrains.exodus.entitystore.*
import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.CLASS_ID_CUSTOM_PROPERTY_NAME
import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.LOCAL_ENTITY_ID_PROPERTY_NAME
import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.linkTargetEntityIdPropertyName
Expand Down Expand Up @@ -140,6 +137,7 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt

override fun generateId() {
val type = oEntityId.getTypeName()
vertexRecord = store.currentTransaction!!.asOStoreTransaction().bindToSession(vertexRecord)
store.requireActiveTransaction().generateEntityId(type, vertexRecord)
oEntityId = ORIDEntityId.fromVertex(vertexRecord)
}
Expand Down Expand Up @@ -571,9 +569,5 @@ fun Vertex.requireLocalEntityId(): Long {
?: throw IllegalStateException("localEntityId not found for the vertex")
}

fun OVertexEntity.asReadonly(): OReadonlyVertexEntity {
return OReadonlyVertexEntity(vertex, store as OPersistentEntityStore)
}


val String.asEdgeClass get() = OVertexEntity.edgeClassName(this)

0 comments on commit 5877618

Please sign in to comment.