I’m trying to sort column data in my h2 database, but it isn’t correct. I think that change of collation may help. I tried to set collation in datasource url in many ways e.g.: spring.datasource.url = jdbc:h2:mem:testdb;COLLATION=’ENGLISH’ spring.datasource.url = jdbc:h2:mem:testdb;SET…
Tag: database
Using 0 as Primary Key
I use lookup tables commonly and sometimes I have some default record in the Lookup table and I think for this record I can use 0 as Primary Key a as shown below: Project: By doing this I can start from 1 for the actual project values (A, B, C…) and on the other hand I can easily distinguish general/def…
JOOQ: How to resolve foreign keys as objects?
Say I have a table that references another table, in this case “TestScenarios” references “TestSchemas”. So each TestScenario HAS-A TestSchema. I autogenerated DAOs, however, when fetching TestScenario instance via the DAO the TestSchema field is an integer, not a TestSchema-object. Ho…
Constructor in a for loop
I’ve a beginner at java programming and I’ve been tasked at creating a database. The database is a bike store with a super class Bike and sub classes mountain bike, road bike. I also have a class …
Oracle 19c compatibility with jdk7
I would like to know if oracle 19c is compatible with jdk 7. I have found out 2 drivers for oracle 19c ojdbc8 : for jdk8, jdk9 and jdk11 ojdbc10 : for jdk10 and jdk11 I would like to know if there is a way to have oracle 19c with a jdk7, and if yes what is the driver that
How to create a sequence in JPA without creating it directly in the database
I am doing a service that gets data from a source and fetches them into my Database by using JPA. The id is generated by using sequence. I have created the sequence on my DB by using this command: However, I don’t know how to create the sequence directly from my code. Can anyone please help me to figure…
HQL Join with three tables
I’m having some issues with HQL since I’m a newbie with it. Even though I don’t have issues with “simple queries”, I am currently stuck with a query involving three tables. I have already gone through some tutorials, but I haven’t been able to find a valid example for my ne…
UNIQUE constraint failed: sqlite database : android
I am trying to insert values in table. But there is only one value inserted. I am getting an error in log cat when I am trying to insert new values. Log cat shows : Its showing error on these two lines while inserting row. EventTableHelper How to solve this?? Answer Your code probably violates primary keyR…
How to call a PostgreSQL stored procedure with Hibernate
I want to create a Stored Procedure in PostgreSQL to make some calculation and return it to My java call. I have tried Most of the option from Java-Hibernate but not able to succeed. Below is my SP. In Java How to call this procedure to get the values. NOTE: I’m not using hibernate XML files to call qui…
How you create confirmation link for email?
In my project I need to send letter to user email with confirmation link. My solution: Add string column “code” and boolean column “is_active” (with default value false) to user table. When user register, generate unique string key and save to database. Send to email link, for example …