I have following classes:
Company.class:
public class Company {
@JoinTable(name = "company_employee", joinColumns = @JoinColumn(name = "company_id") , inverseJoinColumns = @JoinColumn(name = "employee_id") )
@ManyToMany(fetch =…
I am using OpenJPA in my work.
Sometimes I have to use JPQL and sometimes I have to use native query(em.createNativQuery).
I am witnessing a big issue with native query. I have to provide schema name too.
Like for JPQL I can…
I have an entity
@Entity
public class Book {
@Id
@Column(name = "book_id")
@SequenceGenerator(name = "book_book_id_seq", sequenceName = "book_book_id_seq", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE,…
I am trying to use the below query with Hibernate's session.createSQLQuery.
The Entity object corresponding to user has an attribute called address.
The address object is created out of 5 fields from table 'user'.
If I do not use an SQLQuery it gets…
Oracle DB.
Spring JPA using Hibernate.
I am having difficulty inserting a Clob value into a native sql query.
The code calling the query is as follows:
@SuppressWarnings("unchecked")
public List
I have using the Native Query in JPA Repository and my query is as:
select u.*, max(a.version_no) as versionNo from users u left join andother_table a on u.id=a.user_id where u.title='abc' group by id;
from my Query i get the "versionNo" which is…
i try to use NativeQuery of Doctrine. If i use my SQL ind Phpmyadmin i have the good result. If i use this, my var_dump return an empty array. I don't understand why.
$sql = 'SELECT COUNT(id) as nb FROM app_facture f WHERE…
Using JPA, I am trying to fetch data from different tables and to have it in single result list using query:
SELECT x.a, y.b FROM (SELECT * from a) as x, (SELECT * FROM b) as y
However it is throwing an exception:
Caused by:…
I have a query which works fine when I use NativeQuery but I need to use an EJB query for my problem. Can anyone help me reformat my query so it would work for EJB also?
Here is the Native version
Query query =…
Note: I had posted this question on eclipse forums but did not receive a reply though I thought my description of the problem was sufficiently clear.
I am posting it here. It will be great if someone can help.
I have a JPA entity class that does…
i am working on Jpa Native query,
I want all my all send with it count but this my query
select id,status,COUNT(*) as count from tb_abc where sender_id=?1 group by status
But problem is when i will run it on Mysql then it will run fine but when i…
I have this method:
public Long calculateMilisseconds(Calendario calendario, Date inicio, Date fim) throws ApplicationException {
try {
StringBuffer sb = new StringBuffer();
sb.append("select…
I have a simple question. I saw a Symfony2-Tutorial where the blogger used everywhere simple entities without relations and was also using doctrine native-query to do joins and query the different entities.
What is better, to use doctrine native…