Questions tagged [sequence-generators]

81 questions
76
votes
6 answers

How does the JPA @SequenceGenerator annotation work

I am learning JPA and have confusion in the @SequenceGenerator annotation. To my understanding, it automatically assigns a value to the numeric identity fields/properties of an entity. Q1. Does this sequence generator make use of the database's…
Amit
  • 33,847
  • 91
  • 226
  • 299
28
votes
2 answers

Replace @SequenceGenerator since its deprecated

I have a problem with @SequenceGenerator: @SequenceGenerator(name="pk_user_id", sequenceName="seq_user_id", allocationSize=1) @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="pk_user_id") When the application starts up it shows…
Finchsize
  • 935
  • 2
  • 17
  • 34
12
votes
2 answers

asynchronous python itertools chain multiple generators

UPDATED QUESTION FOR CLARITY: suppose I have 2 processing generator functions: def gen1(): # just for examples, yield 1 # yields actually carry yield 2 # different computation weight yield 3 # in my case def gen2(): yield 4 yield…
Ardhi
  • 2,855
  • 1
  • 22
  • 31
11
votes
2 answers

@SequenceGenerator on class annotated with @MappedSuperclass

I have following structure of my entities: @MappedSuperclass public abstract class BaseEntity { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqGenerator") private Long id; } @MappedSuperclass @Inheritance(strategy =…
glaz666
  • 8,707
  • 19
  • 56
  • 75
9
votes
4 answers

Dynamically generating elements of list within list

I have a list, which is made up of the following elements, list1 = [a1,a2,a3] Where each element of this list can itself be a variable size list, eg, a1 = [x1,y1,z1], a2 = [w2,x2,y2,z2], a3 = [p3,r3,t3,n3] It's straight forward for me to set up a…
obtmind
  • 287
  • 4
  • 12
9
votes
3 answers

How to implement a custom String sequence identifier generator with Hibernate

I'm using hibernate with spring, h2 and liquibase and I'm trying to make a custom String id generator for my entities by taking example with this blog post but I'm getting an error : Caused by: org.hibernate.id.IdentifierGenerationException: Unknown…
Takmashido
  • 95
  • 1
  • 1
  • 5
6
votes
1 answer

Invalid Object Name for Hibernate Sequence Generator

I am developing an application that accesses a database running SQL Server 2012 through the Hibernate framework. However, I cannot figure out how to make an instance of the SequenceGenerator annotation work; I get an exception whenever I attempt to…
5
votes
1 answer

Custom data generator build from tf.keras.utils.Sequence doesn't work with tensorflow model's fit api

I implemented a sequence generator object according to guidelines from link. import tensorflow as tf from cv2 import imread, resize from sklearn.utils import shuffle from cv2 import imread, resize import numpy as np from tensorflow.keras import…
Jonah
  • 71
  • 6
5
votes
1 answer

Hibernate Sequence Generator is not Consistent

I have a table with promotion id annotated as @SequenceGenerator(name="GEN_PROMID", sequenceName="SEQ_PROMOTIONID", allocationSize=1) @Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="GEN_PROMID") @Column(name="PROMOTIONID") private…
abhihello123
  • 1,668
  • 1
  • 22
  • 38
5
votes
4 answers

Hibernate @SequenceGenerator not global

I have two entity classes which use generated values @Entity @SequenceGenerator(allocationSize = 1, initialValue = 1000, name = "idgen") public class Ent1 { @Id @GeneratedValue(generator = "idgen") private Long id; …
Ayub Malik
  • 2,488
  • 6
  • 27
  • 42
5
votes
2 answers

Java library for character sequence generator

I need to generate character sequences that increment, where each character can be of a different letter or number range. Does anyone know of a library that does such a task? For example: AAA000_A0 Where A's are any letter A-Z, and 0's are any…
Kevin Lawrence
  • 741
  • 9
  • 18
4
votes
0 answers

Hibernate Migration 4.x to 5.0.7.Final: the framework uses hibernate_sequence instead of mySequence (with Oracle and H2)

I have updated the hiberate version from 4.0.1.Final to 5.0.7.Final(porting from Jboss 7 to Wildfly 10). Problem: The hibernate framwork uses hibernate_sequence for the id generation instead of mySequence. Hibernate configuration: In order to…
Pasquale Vitale
  • 569
  • 1
  • 6
  • 15
3
votes
1 answer

Spring Boot Hibernate not picking up use-new-id-generator-mappings property

I'm upgrading my project to Spring Boot 2.1.18 that uses Hibernate 5.3.18. Previously, my entity looked like thus and would use the SequenceHiLoGenerator: @Entity @Table(name = "group_link") @SequenceGenerator(name = "group_link_seq", sequenceName =…
AHungerArtist
  • 9,332
  • 17
  • 73
  • 109
3
votes
0 answers

Error in HDF5 generator when using multiprocessing and more than one worker

I wrote a generator for Keras that uses Pytables for getting images from an HDF5 file (see code below). It works fine, when calling it like so: self._model.fit_generator(self.training_generator, epochs=epochs, …
packoman
  • 1,230
  • 1
  • 16
  • 36
3
votes
2 answers

Schema-validation: missing table [SEQUENCE_NAME] when using Hibernate Sequence Generator Strategy

I have some problems with the hibernate id generation and a ms sql server. I am using the GenerationType.SEQUENCE in my application to generate Ids with hibernate. @Id @SequenceGenerator(name = "SequenceGenerator", sequenceName =…
1
2 3 4 5 6