Questions tagged [createquery]
76 questions
2
votes
0 answers
org.hibernate.exception.SQLGrammarException: could not insert/select ids for bulk delete
There are the following java-code:
EntityTransaction myTransaction = myManager.getTransaction();
myTransaction.begin();
System.out.println(myManager.createQuery("delete from UserProfile where id >…

abg
- 2,002
- 7
- 39
- 63
1
vote
1 answer
Converting SQL to Doctrine DBAL or createQuery()
How can I rewrite this query to Doctrine DBAL query or better to createQuery() structure? When I used createQuery() "data_last" was not recognized as date but as string and generated errors. Maybe better solution would be internal left join and…

Paweł Madej
- 1,229
- 23
- 42
1
vote
0 answers
IN query with hibernate having list of objects as parameter by grouping
I am trying to do a hibernate query in java using createQuery method where I am have to check group of 3 columns check with WHERE condition as list. But i am getting error Could not determine a type for class:Aliases. I am sure with primitive data…

Chethan
- 73
- 8
1
vote
1 answer
Named parameters not bound
I have a multiple HQL statements which is vulnerable to the SQL injection example:
public List SearchList(String userName, String firstName, String lastName, String email) Exception {
List personList = new ArrayList<>();
String…

Juke
- 1,306
- 2
- 11
- 27
1
vote
0 answers
Inconsistent results when executing JPA's EntityManager.createQuery
I am going crazy about an error in my code involving data persistence in Java (JPA). I didn't develop this and I am not at all knowledgeable about this framework, so, sorry in advance about whatever info I fail to present.
The error in question is…

javier
- 62
- 7
1
vote
0 answers
How to calculate difference between two dates that should support both ORACLE and MYSQL database?
My application supports both databases oracle and MySQL, now I need to calculate difference between two dates .
My code is working with Oracle as it supports " - " operator, but it will not work with MySQL. MySQL has a DATEDIFF function to calculate…

Rajesh Khore
- 325
- 1
- 3
- 7
1
vote
1 answer
How to call oracle function from spring boot application?
My requirement is i need to call oracle function from spring boot application without using NATIVE query.
below is my oracle function which is taking Date as input
create or replace FUNCTION todate(src_dt IN date)
RETURN date
is
BEGIN
…

Harish Bagora
- 686
- 1
- 9
- 26
1
vote
0 answers
How to call custom oracle function in spring boot application?
I need to call custom oracle function from spring boot application without using native query.
below is my oracle function which is taking Date as input
create or replace FUNCTION todate(src_dt IN date)
RETURN date
is
BEGIN…

Rajesh Khore
- 325
- 1
- 3
- 7
1
vote
1 answer
Oracle TO_DATE function parallel in Mysql which should support both DB oracle and mysql
Initially, I was facing one weird problem, below query was running fine in Oracle SQL developer.
select * from sbill.act_sub_t where (act_sub_t.unsub_dt - act_sub_t.sub_dt) < 100;
but I was facing below issue in java Parameter value [100] did not…

Harish Bagora
- 686
- 1
- 9
- 26
1
vote
0 answers
How to convert createQuery response in key value pair?
I am using createQuery function in my application. below is the sample code.
String test = "select t.name,t.descr,t.category from Test t where t.companyId=companyId";
List

Harish Bagora
- 686
- 1
- 9
- 26
1
vote
0 answers
how to filter a proprety in configureShowFields
I need to get only accepted applications in the list of offers
Applications Entity has "state" as proprety . if the application is accepted "state" get "true"
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
…

Mouna Ben Hmida
- 345
- 1
- 7
- 17
1
vote
1 answer
SQL Server: Create new query that matches prices and values from two separate queries
I have a database problem that I have no idea how to code so any kind of help will be much appreciated.
Basically it is matching different schedules with their corresponding prices.
I have two queries . . .
First query contains prices based on…

Ray
- 41
- 7
1
vote
1 answer
Symfony Doctrine QueryException Expected Literal, got 'WHERE'
I have a problem using entityManager->createQuery() in my repository class.
public function findAllByDateAndUser( \DateTime $from, \DateTime $to, User $user ) {
return $this->getEntityManager()->createQuery(
'SELECT wu, a, ai
…

H.W.
- 343
- 1
- 5
- 21
1
vote
1 answer
Symfony2 $em->createQuery() also selects removed objects
Foreword: My script is a bit complicated so I try to reduce the complexity down to a simple example.
Imagine we have an entity "company". We have also a repository-function that looks like this:
public function delete(){
// get company-objects…

SusiMage
- 120
- 7
1
vote
1 answer
How to join many to many in createQuery()
I'm working on my portfolio, and I got a page where I show my project. I created 2 cayegorie for now: Programmation and artistic. Each of my project can be a programming project, an artistique project or both. There for, I made a table project and a…

Kévin Duguay
- 761
- 3
- 12
- 29