Hibernate Questions
Ad
Best way to model Many-To-One Relationships in NHibernate When Dealing With a Legacy DB?
Warning - i am very new to nhibernate. i know this question seems simple - and i'm sure there's a simple answer, but i've been spinning my wheels
Resolved [org.springframework.beans.TypeMismatchException String : Failed to convert value of type 'java.lang.String' to required type
So i am building a site where someone puts a post and people can make comments to the post and people can make comments to those comments --
Failed to convert value of type 'java.lang.String' to required type 'java.sql.Date'
There is a spring mvc app where the customer has the option to place an order. you can set the date and time of the order in the
Failed to convert value of type 'java.lang.String' to required type 'int'; For input string: "save"
**resolving exception from handler [[email protected]]: org.springframework.beans.typemismatchexception: failed to convert
Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'date': it is not exactly10characters long
In my code i have two entities busdetails and user. the user and the busdetails has many to many relationship. whenever i try to book bus, the
Failed to convert property value of type [java.lang.String] to required type [java.lang.Integer]
I am using spring mvc and spring security and hibernate. iam having problem with save 'phone number" to "database". where is mistake? i
Failed to convert property value of type [java.lang.String]
My spring application have problem with save 'date" to "database". where is mistake?
Failed to convert property value of type C3P0PooledDataSource to required type javax.sql.DataSource for property dataSource
I have been gathering many helpful answers from this site in the last few weeks. i joined so that i could +1 to some of the answers i found most
Querying collections of value type in the Criteria API in Hibernate
In my database, i have an entity table (let's call it entity). each entity can have a number of entity types, and the set of entity types is
Getting stated with NHibernate. Real world project example?
One of my goals over the next few months is to get familiar with nhibernate and am curious if anyone out there has any suggestions of where to
Ad
Hibernate Query By Example and Projections
To make it short: hibernate doesn't support projections and query by example? i found this post: the code is this: user
NHibernate one-to-one mapping where second table data can be null
I have an existing database with the table transactions in it. i have added a new table called transactionsequence where each transaction will
Do you always use a second-level cache in Hibernate?
Do you always use a second-level cache in hibernate or do you first try it without and only use it when the performance goes down?
When does Hibernate read from second-level cache and when from DB?
As far as i know hibernate let's you configure entities and collections to be stored in a second-level cache. when does hibernate try to
Hibernate.initialize() and second-level cache
Does anybody know if hibernate's static initialize() method, which populates a proxy object, will attempt to hit the second-level
Enabling Hibernate second-level cache with JPA on JBoss 4.2
What are the steps required to enable hibernate's second-level cache, when using the java persistence api (annotated entities)? how do i check
How do I add regex to @Pattern annotation to match one of two specific strings or a null?
I've added @pattern annotation to a query parameter in my rest controller (springboot kotlin). i would like the regex in the pattern to accept
Incompatible data types while ALTER table in HSQL with Hibernate
How fix next error? error schemaexport:484 - hhh000389: unsuccessful: alter table category_relations add constraint
I want to implement database to my java web app
I am newbie with database. i have knowledge of java. i am using play framework(java not scala) to develop a web app. now for storing
Hibernate -- load an object based on a member object's field
How can an object be loaded via hibernate based on a field value of a member object? for example, suppose the following classes existed, with a
OR condition doesnt work properly in JPA Query
I have the following entities class productunitofmessure @manytoone @joincolumn(name="product_id") private product
Ad
Does hibernate set back reference in @OneToMany @ManyToOne relationship automatically?
I have order entity that has orderitems list. @onetomany(mappedby ="order") list<orderitem>
H2 - Hibernate not inserting Default column values on SQL INSERT
I'm developing a service and currently working on 2 of its entities (section and gradelevel) while i'm still developing,
Flutter Button It should be pressed once in a day
Is there any where i can make a button to be pressed only once in a day. you cannot press that button again in that day. you need to wait till
Can I find by a list of IDs instead the classic findById() in Spring Data JPA?
I am working on a spring boot project using spring data jpa and i am wondering if exist a nice and elegant solution to the following use case.
How can I correctly implement a Spring Data JPA repository method retrieving all the objects related to a list of object? (not to a single one)
I am working on a spring boot application using spring data jpa and i have the following problem. i have this eventlog
JPA/Hibernate Entity show only some fields on GET
I have an entity that has many fields mapped to columns in my database using the @entity and @column annotations. columns might include something
JPA: fetch posts with vote cast by a specific user
I need to load the post entities along with the postvote entity that represents the vote cast by a specific user (the
NHibernate Object References to null in Where clause
I have an isession.queryover code block. in where clause, there is a problem as shown below var receipts= isession.queryover(()
Property or field 'location' cannot be found on object of type javascript
I having troubles to get the object in javascript expression thymeleaf, how can i resolved? i m trying to fill a select option with the
Why is this Spring (Kotlin) many to many relation created with hibernate using postgresql as db crashing?
I have two entities: 1. post. 2. tag. they are implemented as follows: @entity(name = "post") @table(name =
Java Predicates In clause: illegal argument exception?
I am trying to create a java predicate that gets all entities that match a certain id: public predicate
Ad
JPA: how can i map a property to a derived column that is based on a COUNT from other tables (Without incurring in n+1 select problems?)
These are the entities defined in my project: post @entity public class post implements serializable { public enum
The Parent entity inside child entity pull the child again
When i try to fetch the child entity, it also gets the parent entity because of one to many bidirectional mapping but the parent entity inside the
Hibernate generate entity ID non-sequentially
How can i generate ids for object in a non-sequential manner? i would prefer for the ids not to be a linear sequence and thus predictable. yet,
com.ibm.db2.jcc.am.SqlTransactionRollbackException: DB2 SQL Error: SQLCODE=-911, SQLSTATE=40001, SQLERRMC=68, DRIVER=3.65.110
Know that there is a lot of question of this. this is cause by the row of data is update by other thread, and the other thread could not acquire
Play! Behavior for after save model operation
I want to implement a behavior that insert a row in a table after some models saves. my current solution in short is this: (this is just an
Spring Boot REST Hibernate - Get all the cities of a country
With this code: city.java @entity @table(name = "cities") public class city extends auditmodel { @id
Exception in thread "main" org.hibernate.exception.SQLGrammarException: ORA-00917: missing comma
Package org.javab.hibernate; import org.hibernate.session; import org.hibernate.sessionfactory; import org.hibernate.cfg.configuration;
java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: User is not mapped [from User]
I'm getting java.lang.illegalargumentexception: org.hibernate.hql.internal.ast.querysyntaxexception: user is not mapped [from
ORA-02289: sequence does not exist, error in hibernbate
Ora-02289: sequence does not exist, error in hibernbate
IN CLAUSE using createNativeQuery
How to write in clause using createnativequery ? example codelist = "123 ,456"; then i
How to expose fields of and @EmbeddedId
I have an @entity with three fields a, b, c out of which a and b act as composite primary key. i created an @embeddedid
Ad
setParameter issue with createNativeQuery of entityManager JPA
I want to apply parameter binding to the dynamic native query where the column name which i am fetching i will be passing that dynamically from
hibernate criteria single object load
I have two entity(employeeto & restto) there is one-to-many relationship between them,i want to get employee restto list only, but when i
HQL many to many query
I have two tables with many to many relations. products(id, description, price,image)----> products_category(idproducts, category _id)---->
How to use Hibernate with multiple databases on a single server
Our application allows our customer to have multiple databases, all running on one instance of the database server. for example, databases
Search Engine implementation for relational database like Oracle DB
I have a requirement to create a search engine for relational database like oracle. i have to create a search engine with the help of elastic
Data Model Design and Permissioning
I am working on creating structured interviewing app.
Spring JPA data: Querydsl in eclipse giving compilation error while using query dsl classes
I have added below query dsl plugin in eclipse to generate qdsl classes. while using dsl classes in my repository its giving complication
javax.validation.NotBlank missing validator
I have requirement that in common api module(multi module project) i can't use any kind of hibernate's validation annotations, so i did use one
HibernateCallback with Java 8 lambda code
How to use java 8 lambda to refactor this sample properly? i am trying to use java 8 lambda on the following sample:
Spring/Hibernate and relational mapping
I'm new to spring mvc and hibernate (and also databases in general), so would like some help. currently i have 2 tables in my database -
Hibernate query. Cast classes
Have hql query list<developer> developers = session.createquery("from developer d " + "left join
Ad
How to create sequence in JPA without creating directly in Database
I am doing a service that get data from a source and fetch them into my database by using jpa. the id is generated by using sequence. i have
JPQL inner join query
I am stuck in a tricky situation while writing a jpql query, following are my tables:- order_ order_id
Mockito verify invocation error
I would have a problem with the junit tests with mockito. when i try to verify a service i get the error: "actual invocation has different
hibernate in spring doesnt save on mysql database
I have a problem with hibernate spring integration. there is not any error but when hibernate has to save in db the information it launch a
How to validate a List<BigDecimal> with @DecimalMin and @DecimalMax?
In my spring project i have a pojo class with a property for a cmyk color. i want this property to be represented by a json array with exactly 4
Connect to a multiple db(n db) java spring hibernate
I want to make a new ms in spring boot, my app need to connect to multiple db (for now its 40 different servers but lets say n ). i have an api
How can you make a created_at column generate the creation date-time automatically like an ID automatically gets created?
I currently have an entity as below: @entity public class product { @id @generatedvalue(strategy = generationtype.auto)
JPA Repository and constructor with varargs
It is possible to use constructor of varargs in @query (org.springframework.data.jpa.repository). what i mean is class like this:
hibernate + eclipse : mapping doesn't exist for table
I have installed hibernate tools in my ide eclipse. when i launch the hibernate console configuration, it seem to work well. i can show the
spring MVC running cron job
How can i run cron job in spring webmvc framework with hibernate..? currently i have a application with spring-mvc and hibernate.i need to
Hibernate join tables with maps
So i'm getting myself up to speed with hibernate and i've run into an issue that i can't quite understand how to model in hibernate that i could
Ad
Oracle Sequence getting updated by cache size+lastnumber
The sequence in oracle db is getting updated by cache size+lastnumber value, when app server(tomcat) gets restart. my application is using
In JPA, relational databases and etc., What is a Tuple?
I'm studying hibernate and jpa, and i am finding this term all the time. could someone explain me in a practical and didactic way, what is this
Springboot API returns empty response
I built a simple springboot api which is hooked up to a h2 db that contains some test data. however when i hit the api endpoint i get an empty
Hibernate One-To-One Adding child object automatically
I want to add child object automatically in db using hibernate one to one relationship. with following code its not adding foreign key in address
Resetting the primary key to 1
I have a script for microsoft sql server database which has hundreds of tables and tables contains data as well. this is the database of a web
ClassCastException in hibernate with unknown source of HashMap
I'm currently stuck on classcastexception where i cant figure out whats happening exactly. note the query itself
Retrieve DB Column length from hibernate?
To retrieve the db column length from hibernate. i have used: property property =
JPA get MIN/MAX attribute of connected entity
Consider the following two entities: @entity public class hostmachine { @manytomany(fetch = fetchtype.lazy, targetentity =
Exception While working with complex join query
What is the meaning of following exception : javax.persistence.persistenceexception: org.hibernate.mappingexception:
JPA optimistic locking vs synchronized Java method
Using jpa optimistic locking we can control via a @version field if a database table has been updated by another transaction at the same time,
Asp.net MVC Nhibernate : Can not modify more than one base table through a join view
I am working on asp.net mvc web project with nhibernate and mysql. everything is ok but i am randomly
Ad
Hibernate don't cascade update on specific field
I have a mapping problem with hibernate. in a @onetoone relationship, i don't want to cascade the update to the partner. this is my
Hibernate : C3p0 pool configuration slowing down entire server.
I am working on a spring-mvc application in which we are using hibernate and c3p0 for database transactions and connection pooling. most of the
Append Criteria query to previous query in Hibernate
I have a string array named andorbuttonfilter which stores and or filters selected by user. also
nhibernate, class with parents and children causing duplicate keys
Any help you can give is very gratefully accepted. i've been looking at this problem over and over and cannot seem to find the solution. its
Why isn't my NHibernate bag collection setting the 'parent id' of the children dynamically?
I have a new object with a collection of new objects within it on some property as an ilist. i see through sql profiler two insert queries being
Referential integrity constraint violation with Cascade type ALL
I need your help with the following problem: there is a spring boot project, it has two entities: bank and creditdetails, the bank refers to the
How to filter a @OneToMany mapped field in spring data JPA?
I am trying to build an expense tracker application using spring boot rest api. the following are the entity classes i have created. user
Hibernate Contextual sessions
What's the difference between managedsessioncontext and threadlocalsessioncontext both has a threadlocal in their
Hibernate JOIN result set
I encountered a problem using hibernate and spring mvc, that is, if i run a query with a join inside i get a 500 error without any detail, can
Relationship mapping in Hibernate Java - save owning side entity
I have 2 tables user url i'm trying to create a relationship between said 2 tables. a user can have many urls,
Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not determine type for: java.util.Set, at table:
I want to create jpa repository for spring authorization server using this code:
Ad
Multiple Spring JPA relationships between 2 entities
I have 2 entities, one for a tasklist and the other for users. the users can create tasks for themselves or their friends, so in the tasks entity
ERROR 2332 --- [ main] o.s.boot.SpringApplication
I am trying to run this java maven app but i can not win the "fight" with this error. what do you think ? has it happened to any of you before ?
Error creating transaction manager bean
Hi im creating a sample project for springmvc with hibernate with oracle as backend . i am stuck with one issue seems like some configuration
Not able to understand output while using get() and load() function in hibernate
I have a student table with the primary key id. i am using hibernate and session's load command to fetch the record. the records i am fetching ids
How to make a JPA query use primitive ID instead of managed instance?
I tried but i couldn't find a better title so it looks weird but the question is actually very simple... i have a jpa query which uses a
Entity and Table annotations. Understanding the exact differences between them
I am learning hibernate and have some questions about the differences between entity and table, and how they work together/independently?
NoClassDefFoundError when working with Hibernate
I am struggling for a couple hours with one problem regarding the initial setup of hibernate for eclipse. more precisely i am getting this error
DdlTransactionIsolatorJtaImpl could not locate TransactionManager
So, i've been trying for many days to run my project, without success. spring boot + hibernate + jpa. oracle database. can anybody help me?
Hibernate + Spring LocalSessionFactory update query exequte properly but no change saved in database
Package com.kk.mypackage; @repository @transactional public class dbconnectioncredit implements dbconnectioncreditint { @autowired
Hibernate reverse engineering cascade
I'm using the hibernate reverse engineering to generate annotated entities and a cfg.xml for a very large non static set of database tables. is it
How to parse hibernate request with backslash?
I'm trying to get record from database with hibernate query: file f = new
Ad
Exception in thread "main" org.hibernate.AnnotationException: - Use of @OneToMany or @ManyToMany targeting an unmapped class:
Java 11 try to use hibernate here migration sql: create table client ( id bigserial primary key, name
Hibernate mapping a composite key with null values
With hibernate, can you create a composite id where one of the columns you are mapping to the id can have null values? this is to deal
Ad
Blog Categories
Ad