I am very fresh java beginner and I am trying to implement possibility to review documents. User, who belongs to a certain group can review documents of particular types that are assigned to that …
Tag: jpa
@Where with @SecondaryTable does not work with Hibernate
There is a one-to-many relationship in my model, where the child entity is stored in two tables. @Entity @Table(name = “child1”) @SecondaryTable(name = “child2”, pkJoinColumns = { @…
how to fetch data from two tables in JPA
I am not able to fetch all records from two tables using the below query I have tried this but I am getting a result from one table only. I want a result of both the tables i.e, …
JPA distinct inner join with Condition on joined table
I have two tables below: I want to get the college object with list of students of a specific department. The SQL query is below: So far I have tried the below JPA query but it is returning multiple College objects. How to return a single college object with list of students with filtered department? NOTE: I can’t alter the
How should I pass values into JPQL query?
I’m working on test, that will check if object had been saved into database. Test will save object with unique values and after that I want to fetch this object from database and check if it is not …
Hibernate not allowing to increment by 5 in sequence
I have following db sequence Java However with Hibernate I am getting following error which says hibernate is expecting increment by 50. Why is so? Edit1 Added java code. Answer The error message is quite clear. You have enabled (or not disabled) schema validation, so when the application starts Hibernate is comparing the database with what it expects from annotations
MSSql server jpa spatial exception
Is it possible to use sql spatial data in jpa? I ve MS SQL Server 2014 Express Edition. I m trying to use spatial data as follows; maven (pom.xml) dependencies; db dialect; spring.jpa.hibernate.dialect=org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect entity definition; @Column(columnDefinition = “Geometry”) private Point location; creation of data; SampleEntity se = new SampleEntity(); se.setName(“Sample1”); se.setAge(30); GeometryFactory gf = new GeometryFactory(new PrecisionModel(), 4326); Point location1
Getting column names from a JPA Native Query
I have an administrative console in my web application that allows an admin to perform a custom SQL SELECT query on our database. Underneath, the application is using Hibernate, but these queries are …
JPA: @OneToMany(fetch = FetchType.EAGER), pagination and duplicates
I use eclipselink as a JPA provider. I have an entity Article which has many Authors (this field is marked @OneToMany(fetch = FetchType.EAGER)). Article and authors are loaded together using only one …
Difference between query, native query, named query and typed query [closed]
What are the differences between a query, a native query, a named query and a typed query? Does the ‘alone-standing’ query even exist, or is it just an abbreviation? In my mind, a native Query is a …