I have the following that contains a NativeQuery where i need to set a parameter but somothing is wrong beacause parameter not set so the query is
SELECT movieId, title, genres FROM movies where title like '%%'"
so return all the rows. What is…
The following method uses the createNativeQuery() method of the Java entity manager:
public List findDogById(String id) {
List resultList = new ArrayList<>();
try {
resultList =…
I have many EntityManager, one per schema that I have (I use entity-mappings file to map EMs with schemas). It works.
When I use @NamedQuery it's working like a charm but when I use @NamedNativeQuery schema is not used. I have to qualify with it…
I use KnpPaginatorBundle in my Symfony2 project. When i try to pass a Doctrine 2 native query to paginator instance, I got error:
One of listeners must count and slice given target
Have anyone some example of correct implementation of this for some…
I would like mapping a sql-view with Doctrine2.
This view is a TempTable containing some statistics that would show without rewriting the sql that generates the view
I try to map like a table, but updating schema drop the view and create a table
I…
I have a query where I need to check first if the input parameter is null or compare the column value to pass input parameter. It means that the column value can be null or pass the specified condition (?3 is null or cd.name like %?3%).
public…
Based on my last post: Spring JPA long SQL String for NativeQuery
I've managed to find a "place" to write clean SQLs so that I can directly copy and paste it in the DB software for faster testing.
But another problem comes, if I wan to segregate my…
In our application we have many native queries (usually, overall when we need to perform some JOIN, LEFT JOIN or FROM clauses using a view on the fly).
Moreover, many queries are repeated in many EJBs but the only things they change are some…
I need to implement a query in Spring Data like this :-
Select User.name, sum(Activity.minutes)
From User, Activity, ActivityStatus
Where User.id = ActivityStatus.userId
And Activity.id = ActivityStatus.activityId
AND ActivityStatus =…
I am trying to run the following Query in Spring 4.2.4:
@Query(value="SELECT * FROM (SELECT ROW_NUMBER() OVER(ORDER BY i.TYPE_NUMBER ASC) AS RN, i.* FROM Item i) AS g WHERE RN between ?#{ #pageable.offset} and ?#{#pageable.offset +…
I have a parent table and a child Table in my DB, and have a OneToMany mapping for them in their corresponding entity classes. The child table has a foreign key parent_id. I am using JPA 2 with Hibernate and MySQL DB.
I wish to retrieve all the…
This is method to get Module entites within specified level for related backend.
public List getModulesWithinLevel(Long backendId, ModuleLevel... levels) {
String joinedLevels = serializeLevels(levels);
Query query =…
I'm using Hibernate (3.3.x) and I have two entities:
public class FtChargeAcctPkgDtl {
private FtChargeAcctPkgDtlId id;
private Set ftChargeAcctPkgRates;
}
and
public class FtChargeAcctPkgRate {
private…
Thanks for your attention, and sorry for mi English :S
I'm using JPA 2.0 with Hibernate 4.X to do some sql native queries. Te code is very simple:
private void doIt() throws Exception {
EntityManager em = getEntityManager();
Query q…
I want to make a query verify value as contained into array in Postgres. I made a nativeQuery in JPA the query apparently is correct and is working in DBeaver(DBM), but not in java application.
,
ERROR: operator does not exist: integer[] @>…