Skip to content
Advertisement

Tag: hibernate

Spring Boot cannot create database table in mysql 5.7

I’d like to create a table called dni with that information in mysql server. Querys that failed: 1.”create table dni (id bigint not null, apellidos varchar(255), codigo_dni varchar(255), direccion varchar(255), fecha_nacimiento varchar(255), foto_perfil varchar(255), nombre varchar(255), primary key (id)) engine=MyISAM” 2.”create table hibernate_sequence (next_val bigint) engine=MyISAM” What I tried: –> put @Table(name = dni) –> put this on pom.xml org.hibernate.dialect.MySQL5Dialect

Translate SQL into Hibernate HQL

I’m using Spring boot along with Hibernate. I’ve only recently started using Java so I’m not quite good at it. I have a OneToMany unidirectional relationship with a join table. RssUrl Table User Table Join table I’m trying to translate this SQL into HQL It’s basically checking if a url is already associated with a user. I’m sure it’s not

JPA SpringBoot – Unable to Save New Entity to Database

I am attempting to add (save) a “User” to my SQL database through my Spring application (The @GetMapping requests currently work). I recently added the two annotations @CreationTimeStamp and @UpdateTimeStamp in my entity class…the version without those two annotations would produce the same errors as shown. I am testing the API with Postman-here is my Users entity class: my UsersDTO

Spring boot hibernate complex table relationship works partially

I have following models they have one-to-one and one-to-many and many-to-one relationship. Most of the model are fine except one. My json data: Java models: After inserting data in H2 DB, I can see flowing tables and data. Car: Vehicle: Location: As you can see all data is fine except Location. It has missing warehouse_id. What did I miss? Also

NamedQuery returning entities with null fields

defined entity with namedquery as SELECT mdl FROM tbl_slots mdl where mdl.test_date between :dt and :dt order by mdl.test_time asc if used * instead of mdl in query, JPA gives error unexpected token: * if mentioned the column names in select statement it returns entities with respective fields populated with expected values [{ “srNo”: 1, “testDate”: “2021-Dec-30”, “testTime”: “09:00-10:00”, },{

Advertisement