Questions tagged [id-generation]

81 questions
1
vote
2 answers

Modify Id generation for a Grails Plugin

I am using a plugin for Grails - the Amazon S3 plugin - and the domain object provided by the plugin doesn't specify the Id Generator. I am using Postgresql and require the id genrator to be identity. I could copy the plugin in my plugins directory…
1
vote
1 answer

could not interpret id generator strategy : x.y.z.CustomIDGenerator

i've facing Hibernate mapping issue : could not interpret ID generator Strategy : Stack Trace : Exception in thread "SpringOsgiExtenderThread-14" org.springframework.beans.factory.BeanCreationException: Error creating bean with name…
Tejas Patel
  • 89
  • 4
  • 16
1
vote
1 answer

Auto generated domain class id with exceptions

Scenario: Domain class is created and inserted using the default Postgres sequence generator (with a custom dialect to create one sequence per table but I think this is irrelevant). Now, in some cases I'd like to choose my own ID for insertion. I…
user462982
  • 1,635
  • 1
  • 16
  • 26
1
vote
0 answers

What happens if hibernate_sequences table is accidentally reset?

I am using hibernate with ID annotations: @Id @Column(name = "ID", nullable = false) @GeneratedValue(strategy = GenerationType.TABLE) For some reason the hibernate_sequences table, which is managed by hibernate, has been reset. ie. Newly inserted…
gjrwebber
  • 2,658
  • 2
  • 22
  • 26
0
votes
0 answers

How can I have multiple ways of generating rawId in spring for an entitiy in hibernate?

I have a situation of doing dual writes where I want to first save the object to a microservice, retrieve the rawId and then save it in the monolith as well. Upon doing application.setId(rawId) I get optimistic locking failure exception . This whole…
0
votes
0 answers

Are snowflake ids generated on multiple machines sortable

I am reading https://en.wikipedia.org/wiki/Snowflake_ID There are 41 bits for time epoch in each generated id. but if these ids are generated on multiple machines, but the time on each machine are not aligned. how to make sure all ids are sortable…
BAE
  • 8,550
  • 22
  • 88
  • 171
0
votes
0 answers

Generate permanent ID per a Windows computer

I don't know if it is possible. I am developing a desktop app and I want to find a way to generate a permanent ID per a Windows computer in C#. "Permanent" means this ID won't be changed between re-installations on the user computer. I thought to…
Rougher
  • 834
  • 5
  • 19
  • 46
0
votes
1 answer

MongoDB - Insert 2 documents, each in another collection but share ObjectId

I have this question: I want to insert 2 documents into 2 collections. One is for user and one is for company. Both inserts are requested via api. In created(Inserted) company I want to know, which user[Created/inserted] create this company. And in…
Dufino
  • 33
  • 6
0
votes
0 answers

How create a custom prefixed id jpa hibernate with @TableGenerator and reset the counter every year per location

I have a different product made from differents places. I need to create a custom key. Product String id String name String description String source ... Id is a String with this format and the counter must be reseted every year …
0
votes
1 answer

Assign and maintain sequential Worker-Number or NodeId in Kubernetes

When a Kubernetes Spring-Boot app is launched with 8 instances, the app running in each node needs to fetch sequence number of the pod/container. There should be no repeating numbers for the pods/containers running the same app. Assume that a pod…
0
votes
1 answer

Assign Incrementing uint ID in constructor in C#

I have a class that supposedly handles generation of a unique ID of uint type. However upon multiple use, the uint value does not seem to increment. static class UniqueIdGenerator { public static uint nextUnique; public static…
Programmer
  • 291
  • 1
  • 3
  • 14
0
votes
3 answers

Getting Error while setting generated id in hibernate

I have a Student object which i need to save in database. The id : studentId is defined like in HBM :- Now, for…
M.J.
  • 16,266
  • 28
  • 75
  • 97
0
votes
1 answer

Hibernate: Custom ID generator needs to persist entity

I'm implementing a custom Id generator for Hibernate. In my generate-method I need to read from another table and modify data on it. That's (about) the way I would do it: session = sessionFactory.openSession(); Transaction transaction =…
martin
  • 2,150
  • 1
  • 34
  • 48
0
votes
1 answer

Getting used ID generated by IdGeneratorStrategy after shutting down system

I'm working on a web app with GWT running on an embedded Winstone server and I'm using Derby as database with a persistence manager. I'm generating a persistent class with a Long ID, which is generated by the IdGeneratorStrategy.IDENTITY. The…
William
  • 23
  • 1
  • 3
0
votes
2 answers

org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.app.entites.LDetails

I tried many time to insert id value in my table using below code, but it always throwing org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.app.entites.LDetails following is the…