Nico van de Kamp

Ranch Hand
+ Follow
since Jan 25, 2017
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nico van de Kamp

Hello,

I'm still struggling and fighting to get a OneToMany/ManyToOne working. The examples I have found till now, have the same issue and I have also found here the question but not the solution or I do not understand it.

I have the two Entities:
parent Employee @OneToMany:The Child side: @Many-To-One:

The update employee service implementation:

And this is what I inject with Postman the create (POST):

I have two "employeeModelLogging" records at the time of creation of an Employee.

Now I do an update with postman:

When I execute the update, than there are still two records in the database. (It is not a problem to update fields from the employee or department, etc. This is working fine)

I have tried this, by removing the second recordThe second loggingModel is removed from the JPA I think, but not in the database. But I this, if this should work, than at least I know which way I have to go...

I hope that someone has an idea and can tell me what I'm doing wrong...
Hi Rob,

Thanks for you're help,

Rob Spoor wrote:I take it that the model classes are mapped from JSON directly to your entities, right? If so, you're running into a bidirectional relation that is only set on one side. The unmarshalling from JSON creates new LoggingModel instances, and puts them into a list. It then sets that list on the created EmployeeModel instance. The EmployeeModel instance now has a reference to all of its LoggingModel instances. What is still missing is the reference in the LoggingModel instances to the EmployeeModel instance. The JSON unmarshalling doesn't set this because it simply doesn't know it should.

A quick solution is to fix these references yourself. A quick for-each statement will suffice:



Although I do not know what 'unmarshalling' exactly means, it is all right what you here suggest!!!

But I'm AMAZED that what you suggest here works!!!.

I've changed the code into this: So I add you're line just before saving the new employee model. What is amazing me, is that the id of employee is still unknown because the Employee is not saved or...,
Does it work in this way: JPA knows the next id sequence number for the Employee Entity. So this number is retrieved from the JPA and saved as FK for the loggingModel. Is this what is happening?








I have two entities:

I understand the problem. The FK (name: LOGGINGEMPLOYEEMODEL_ID ) is in the tabel "loggingmodel".
At the moment of new record saving for the parent table 'employeedetails' the child table should also be updated.  But I get the error: "org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: NULL not allowed for column "LOGGINGEMPLOYEEMODEL_ID"; SQL statement:
insert into LoggingModel (infotext, loggingEmployeeModel_id, title, id) values (?, ?, ?, ?) [23502-199]"

I understand it, the new id for the employeedetails is unknown for the FK for child table. (If it take the part "employeeModelLogging" out of the Postman injection, than I don't get the constraint error, so it should the loggingModel part)

How do I solve this within JPA - Hibernate?

The parent side: One-To-Many:

The Child side: Many-To-One:


The create employee service implementation:

And this is what I inject with Postman:

Can someone can give an idea/hint what I'm doing wrong?
Thanks Rob,

Again 'slowly' I think that I understand what I need todo:

There are some ways to fix this. One is to create POJOs for your REST responses. You end up mostly duplicating your class, but you can easily leave out the things you don't want.

I prefer the first way, because
it allows me to create different POJOs for retrieving EmployeeModel instances with nested Role instances, or the other way around. If you ignore these in your entities, you can only have one of these options
it will ignore anything I don't want. That includes any properties added by the JPA framework (I remember TopLink adding its own properties)



I was thinking why is it necessary to create new DTO POJOs? I'm satisfied by commented out the private List<EmployeeModel> employeeRoleModel in the Role Entity, there is no recurrence of data in the response, so it is good. But if I want to do something with the Roles POJOs, for instance maintenance CRUD, I'm getting in trouble or I need to define a new Role Entity or something like that if possible

Now I return for my REST responses the 'emloyeeModel', which I think have to replace by the new POJOs EmployeeModelDTO class instance. Here I define the EmployeeModelDto (which is than more or less duplicate with EmployeeModel), AND return the EmployeeModelDto as response to frontend(Postman), that is the most important thing to realize/understand.

Another way to fix this is to mark the employeeRoleModel as ignored during serialization. How to do this depends on the serialization framework. For instance, for Jackson you'd use @JsonIgnore.

I see code where they have more or less choosen for this solution.

I have the feeling of you're first approach is better because it is more flexible and is further independent what is happening in other entity's - loosely coupled.
Hello Rob,

Thanks. I don’t know if I understand you but do you mean by creating different POJO’s.
The Role class I have made and with commented out List<EmployeeModel> employeeModel, so that the employeeRoleModel properties are not included
And make another Role POJO for maintenance screen of Role, because Role need to be filled with reference data.

Is that what you mean?
Hello,

I have a many-to-many relation defined like:

My Role entity:

If I do a GET with Postman and the parts mentioned commented out are inactive, than I get in my opinion the right data for the response:


Technically I have find out were it comes from, if i activate the lines which I have mentioned "commented out", than it is getting recurence!!??
I have roles added to the employee that's good. But the GET is also returning the roles wiht the employee etc.
My Question: why is this made in this way? And when do I need this? I mean I can't imagine if you are working on an entity, that a response as shown here beneath would be used for the frontend, or...

If you're not using an Entitymanager, then who's doing the persisting? Is this an EJB3 container?

I do not understand the question sorry, I think due a lack of knowledge of my.

Anyway, good luck on the Many-to-Many. I find that one to be the most challenging of all!



I have the many-to-many also get to work, with a static data table. I think the solution for this "cascade = CascadeType.MERGE" or not? If I use 'CascadeType.ALL',  new records are added to the static data table, with a same value. With MERGE nothing is added and/or changed at the static data table.

I have some other questions, but I will put this in another thread.

Hello Tim and Rob,

Thanks for you're help.
Slowly I realize what is going on behind the mappings as @ManyToOne etc.
My mindset:
When I have declared the @ManyToOne annotion (using: spring.jpa.hibernate.ddl-auto=create-drop), the field "unit_id" is 'automatic' created by Hibernate.
I thought thats smart, Hibernate knows that for the emloyee instance only the FK 'unit_id' is needed. By returning the value of the dropdown (=unit id ), of the frontend (postman) will be enough. (At least with PHP is this enough.)
Another reason why I didn't think about that I do not need the unit instance, because I do want only to save/update the employee instance, not more not less

As Tim already said

As I said before, ORM is not the same thing as SQL. Entity Objects don't link to other Entity Objects by key value. They link as Object properties (references).


I have under estimate this, I realize now.

So I understand now a complete unit instance is necessary and this working now!

The weekend I was busy again and I discovered the persistence manager you also mentioned.
To learn myself if the frontend only returns the value (= id) of the dropdown, than I will get the unit instance by id.

First I saw and have added an persistence.xml (which I think is not really necessary, because I'm not using 'EntityManagerFactory'):

This is what I have defined in my Employee (model)

And here is the code of my serviceimpl

And this is what in inject with Postman:

This is working for me now so far. I don't know if someone of you says, this is a good at least this is the direction which I have to go.

One more to go, an Many-To-Many with a join table and also static (or reference) data.

Tim and Rob thanks a lot for you're assistence both!

Rob Spoor wrote:Are you sure that an Employee's unit cannot be changed? Perhaps that's where the issue lies, especially if you assign a different unit.



Yes, the unit table itself will not be changed. Of course the FK unit_id value of an Employee can change. If a employee is moved to another unit, than the the FK unit_id value will be changed by updating of the employee. But the Unit entity (table) will not be changed.

The Unit table will be changed when a new Unit exist, than the Unit table will be added by a new record, but that needs to be done independent from employee.
Hello Rob,

Thanks, you describe it completely right:
- Many Employees can be linked to a unit
- The unit table will be filled before the app is executed, it's a reference table (or static data table I don't know how this is exactly called in Engilsh, in dutch it is called 'stam tabel'). This value's wil be used in a dropdown/lookup field at the frondend

Here my code for the Employee side (parent)

And this is code for the unit side:


And this is my postman JSON insert:

And do still have this error:"org.hibernate.TransientPropertyValueException: Not-null property references a transient value - transient instance must be saved before current operation : nl.nkamp.crud.model.EmployeeModel.unit -> nl.nkamp.crud.model.Unit; nested exception is java.lang.IllegalStateException: org.hibernate.TransientPropertyValueException: Not-null property references a transient value - transient instance must be saved before current operation : nl.nkamp.crud.model.EmployeeModel.unit -> nl.nkamp.crud.model.Unit"

(What I not understand is, I think this is very common in software working with a reference table. Also for a Many-To-Many situation. But I can't find a good example...)
Hello Tim,

Thanks. I have changed it to @OneToMany, I still have that bloody error.

There are a lot examples with @ManyToOne, @OneToMany and @ManyToMany, but till now I couldn't find examples with static data.
(Or instead of static data: constant data, reference table, lookup, list of values)
1 month ago
I'm trying to figure out how to map an an parent table 'Employee', with an static data child table. (Is 'static data' the right name for this or do you call it:  reference data, list of values, lookup data?)

When I insert an new employee the id record number of the static table data record must be added to the employee table. Nothing needs to be changed on the static data table side (= child table).

Unit is my static data table with the fields: id, unitcode, description.

This is my mapping on the employee side:
In the employee table I have an field 'unit_id' (generated by Hibernate, due to ManyToOne declaration, that's for me an indication that it is till so far good)

On the unit side I have nothing defined.

When I insert an employee record:I get the error: org.hibernate.TransientPropertyValueException: object references an unsaved transient instance - save the transient instance before flushing : nl.nkamp.crud.model.EmployeeModel.unit -> nl.nkamp.crud.model.Unit
But this error indicates if I'm right, that hibernate want to save the data on the side of the child table and it is gone, before it can be saved on the parent side. But I only want to save the unit id on the parent = employee side.


I have tried different FetchTypes.

I hope that someone can point me in the right direction to help me out.
1 month ago
Ok, maybe for the most is this clear what the next line is doing:
I wasn't aware and didn't realize that this is defining the database from the entities. I have defined the database by SQL scripts. BUT I had not defined one sequence and I was asking myself: were does that number 50 come from!!???

I understand now more what's going on, although it is still strange for me why that number 50? I have never had an sequence which is incrementing by 50 or....
I have delete my database and generate the tables with sequences again.
I have created the project from scratch again but copying the code from the project which give the trouble.
Add for both table's the sequence like:

And

After that solved I get ODD and Negative id's! I do understand now why because adding the allocationSize is the solution. (I thought that I did this earlier but still had that error... or there was something more which I could not remember anymore)

But there are also raised some other questions:
I did not find the reason/advantage why sequenceGenerator annotation is treating the value by default with 50!!!???
Without adding allocationSize WHY IS THIS: "So when Jpa persist that record and demand sequence value from database, it treat that database sequence has incremented that value by 50 so it will substract 50 from that value and try to persist record with that value.". I understand now why I get with my first test the id of -49, -48, -47 etc. Strange, or...?
Now the sequence is defined in JAVA, but it is possible to define and add the sequence in the database right to the 'id'. Which is better?

Hello,

I'm following the example/tutorial asbnotebook.com, but I'm running into issue:
  • Failed to initialize JPA EntityManagerFactory: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not instantiate id generator [entity-name=net.javaguides.springboot.model.Address]
  • Caused by: org.hibernate.MappingException: The increment size of the [address_sequence] sequence is set to [50] in the entity mapping while the associated database sequence increment size is [1].


  • I understand that it has something todo with the SequenceGenerator and I have added the property " allocationSize=1":

    This is my database table with sequence (copied from the example) :


    My questions

    [li]- Error message: "The increment size of the [address_sequence] sequence is set to [50] in the entity mapping...", But where is this done and I believe it is done by default. This done by Hibernate I think, but where??[/li]
    [li]- I'm working in Eclipse[/li]
    [li]- I'm using postgres database[/li]
    [li]- I have created a new project with the code of the example, and this is working with the same database. So it must be somewhere in the java code/hibernate cofiguration. I have compared java the files, application.properties, pom.xml, except spring boot version 2.4.5 and the example 2.1.5[/li]
    [li]- If I change the line into "@GeneratedValue(strategy=GenerationType.IDENTITY)", than I don't have an error anymore. But I try to find out why my project isn't working like the example.  [/li]

    Any idea's or advice will be appreciated, thanks

    Console log:

     .   ____          _            __ _ _
    /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
    \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
     '  |____| .__|_| |_|_| |_\__, | / / / /
    =========|_|==============|___/=/_/_/_/
    :: Spring Boot ::                (v2.4.5)

    2021-08-10 15:05:09.046  INFO 29780 --- [  restartedMain] pringbootBackendCrudFullstackApplication : Starting SpringbootBackendCrudFullstackApplication using Java 16.0.1 on ASUS-LAPTOP with PID 29780 (D:\dev_workspace\Java_2\CRUDFullstackApplicationWithServiceLayer\target\classes started by nico in D:\dev_workspace\Java_2\CRUDFullstackApplicationWithServiceLayer)
    2021-08-10 15:05:09.049  INFO 29780 --- [  restartedMain] pringbootBackendCrudFullstackApplication : No active profile set, falling back to default profiles: default
    2021-08-10 15:05:09.104  INFO 29780 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
    2021-08-10 15:05:09.105  INFO 29780 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
    2021-08-10 15:05:09.977  INFO 29780 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
    2021-08-10 15:05:10.033  INFO 29780 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 47 ms. Found 1 JPA repository interfaces.
    2021-08-10 15:05:10.581  INFO 29780 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
    2021-08-10 15:05:10.592  INFO 29780 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
    2021-08-10 15:05:10.592  INFO 29780 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.45]
    2021-08-10 15:05:10.695  INFO 29780 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
    2021-08-10 15:05:10.695  INFO 29780 --- [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1590 ms
    2021-08-10 15:05:10.893  INFO 29780 --- [  restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
    2021-08-10 15:05:10.960  INFO 29780 --- [  restartedMain] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.4.30.Final
    2021-08-10 15:05:11.103  INFO 29780 --- [  restartedMain] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
    2021-08-10 15:05:11.217  INFO 29780 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
    2021-08-10 15:05:11.764  INFO 29780 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
    2021-08-10 15:05:11.804  INFO 29780 --- [  restartedMain] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL10Dialect
    2021-08-10 15:05:12.582 ERROR 29780 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not instantiate id generator [entity-name=net.javaguides.springboot.model.Address]
    2021-08-10 15:05:12.582  WARN 29780 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not instantiate id generator [entity-name=net.javaguides.springboot.model.Address]
    2021-08-10 15:05:12.588  INFO 29780 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
    2021-08-10 15:05:12.663  INFO 29780 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
    2021-08-10 15:05:12.665  INFO 29780 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
    2021-08-10 15:05:12.682  INFO 29780 --- [  restartedMain] ConditionEvaluationReportLoggingListener :

    Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
    2021-08-10 15:05:12.706 ERROR 29780 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not instantiate id generator [entity-name=net.javaguides.springboot.model.Address]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1786) ~[spring-beans-5.3.6.jar:5.3.6]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602) ~[spring-beans-5.3.6.jar:5.3.6]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.6.jar:5.3.6]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.6.jar:5.3.6]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.6.jar:5.3.6]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.6.jar:5.3.6]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.6.jar:5.3.6]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.6.jar:5.3.6]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[spring-context-5.3.6.jar:5.3.6]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.6.jar:5.3.6]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.5.jar:2.4.5]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:782) ~[spring-boot-2.4.5.jar:2.4.5]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:774) ~[spring-boot-2.4.5.jar:2.4.5]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) ~[spring-boot-2.4.5.jar:2.4.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) ~[spring-boot-2.4.5.jar:2.4.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1340) ~[spring-boot-2.4.5.jar:2.4.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) ~[spring-boot-2.4.5.jar:2.4.5]
    at net.javaguides.springboot.SpringbootBackendCrudFullstackApplication.main(SpringbootBackendCrudFullstackApplication.java:21) ~[classes/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.4.5.jar:2.4.5]
    Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not instantiate id generator [entity-name=net.javaguides.springboot.model.Address]
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:421) ~[spring-orm-5.3.6.jar:5.3.6]
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-5.3.6.jar:5.3.6]
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.3.6.jar:5.3.6]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1845) ~[spring-beans-5.3.6.jar:5.3.6]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) ~[spring-beans-5.3.6.jar:5.3.6]
    ... 22 common frames omitted
    Caused by: org.hibernate.MappingException: Could not instantiate id generator [entity-name=net.javaguides.springboot.model.Address]
    at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.createIdentifierGenerator(DefaultIdentifierGeneratorFactory.java:124) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
    at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:355) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
    at org.hibernate.internal.SessionFactoryImpl.lambda$new$1(SessionFactoryImpl.java:289) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
    at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[na:na]
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[na:na]
    at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1766) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
    at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[na:na]
    at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
    at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[na:na]
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:288) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
    at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:468) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1259) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58) ~[spring-orm-5.3.6.jar:5.3.6]
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.3.6.jar:5.3.6]
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-5.3.6.jar:5.3.6]
    ... 26 common frames omitted
    Caused by: org.hibernate.MappingException: The increment size of the [address_sequence] sequence is set to [50] in the entity mapping while the associated database sequence increment size is [1].
    at org.hibernate.id.enhanced.SequenceStyleGenerator.configure(SequenceStyleGenerator.java:261) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
    at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.createIdentifierGenerator(DefaultIdentifierGeneratorFactory.java:118) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
    ... 43 common frames omitted


    1 month ago