Questions tagged [createquery]

76 questions
0
votes
1 answer

Using CreateQuery to get a parent object with its children collection

The question is to get all parents whose all children age is above a certain age.The expected output should also include the children list with their parent. I have the following... session.CreateQuery("select p, c from Parent as p left outer join…
user1163205
  • 51
  • 1
  • 3
0
votes
1 answer

how can i nest two AND queries in Doctrine2 using createQueryBuilder?

following is my query : $em = \Zend_Registry::get('em'); $qb_1 = $em->createQueryBuilder(); $q_1 = $qb_1->select('link_req') ->from('\Entities\link_requests','link_req') ->where( 'link_req.is_confirmed = 1' ) …
Always_a_learner
  • 4,585
  • 13
  • 63
  • 112
0
votes
2 answers

create table table1 as select .. from sysibm.sysdummy1

In DERBY, I have a table which name is TEST1. I can run this code perfectly. CREATE TABLE Table1 AS (SELECT * FROM TEST1) with no data But I can't run this code and derby. CREATE TABLE Table1 AS (SELECT ..... FROM sysibm.sysdummy1) with no…
neverwinter
  • 810
  • 2
  • 15
  • 42
0
votes
1 answer

how to do a join in doctrine with createQuiry or DQL

What i want is to do is this query in doctrine : SELECT * FROM `reservation` JOIN res_chauf ON reservation.reservation_id = res_chauf.reservation_id WHERE res_chauf.chauffeur_id =1 in doctrine/symfony2 with DQL i know how to do just a select like…
I_G
  • 413
  • 1
  • 4
  • 18
0
votes
1 answer

hibernate curious mistake in consult

im doing my first trying in hibernate and i get this question. When i do this consult i get correct result List result = session.createQuery("select t from Tarea t where t.subtipo = 1").list(); but if i use one parameter give me a error List result…
r1k4r2
  • 75
  • 1
  • 8
0
votes
1 answer

Path expected for join error

I'm attempting to execute the following query and I get the above error. Any ideas? session.CreateQuery("SELECT SUM(NumberHead) AS numberhead " + "FROM Purchase " +"INNER JOIN Lot " +…
Fabii
  • 3,820
  • 14
  • 51
  • 92
0
votes
0 answers

CreateQuery constructor with getting parameter list

I'm new here and this is my second question, but as the first, I have a problem already tried to solve in different ways, but have not found a solution, so I'm resorting to you, here we go. My code: string sql = "SELECT NEW…
0
votes
1 answer

QueryInvalidParametersException: Query has parameter "surveyId" supplied at execution yet the query doesnt make use of this parameter

@NamedQueries({ @NamedQuery(name="surveyResponse.getAverageRatings", query="SELECT AVG(ratings) FROM SurveyResponse surveyResponse WHERE surveyResponse.customerSurvey.surveyId = :surveyId"), @NamedQuery(name="surveyResponse.getBySurvey", …
beetri
  • 1,039
  • 11
  • 24
  • 40
0
votes
1 answer

Entity SQL vs CreateQuery where one works and the other errors for the same query

I can use following line of code to create a query that only returns objects of 'ActivityEntity' type.... var q = CreateObjectSet("EntityBases").OfType() .. and running the query works as expected. But I want to actually…
Phil Wright
  • 22,580
  • 14
  • 83
  • 137
0
votes
2 answers

How to select one table using NHibernate CreateCriteria

How can I create the following SQL statement in Nhibernate using CreateCriteria: SELECT distinct top 20 a.* from ActivityLog a left join WallPost w on a.ActivityLogId = w.ActivityLogId left join ItemStatus i on i.StatusId = w.ItemStatus I always…
Hem
  • 1
  • 2
0
votes
1 answer

Alternative namedquery for nativequery

i need to change my query from native-query to (named-query or create-query) in jpa. em = getEntityManager(); String query = "SELECT kcu.table_Name FROM INFORMATION_SCHEMA.key_column_usage kcu,Information_schema.Tables kt " + "WHERE…
jackrobert
  • 131
  • 6
  • 22
0
votes
1 answer

JPA EclipseLink getCount of child entity

I am using EL and i keep getting 0 when i run the query below. I want to get the count of applicants (AP) that are currently active. The child entity Applicant is of Person and i want to avoid querying all elements of…
Warz
  • 7,386
  • 14
  • 68
  • 120
0
votes
1 answer

Combining LEFT OUTER JOIN and WHERE clause on right table in Doctrine2

I have the following query. $objEmployee = $this->getEntityManager() ->createQuery( "SELECT e FROM MyProjectEntityBundle:Employee e LEFT OUTER JOIN e.project p where p.name like % abc %" …
Shrujan Shetty
  • 2,298
  • 3
  • 27
  • 44
-1
votes
1 answer

CreateQueryBuilder to find a string in an array?

I want to find if a $work (string) exist in Works (array), how can I write the request? public function findByProject($project, $work) { return $this->createQueryBuilder('p') ->andWhere('p.project_type = :project') …
rzp789
  • 1
  • 1
-1
votes
1 answer

How to set a CONSTRAINT for mobile no. field using CREATE query in mysql

I have tried all the combinations of LIKE and NOT LIKE but unable to set a CONSTRAINT for mobile number field, as I want to create table using CREATE TABLE patient ( pname VARCHAR(20) NOT NULL, mobNo VARCHAR(15), CONSTRAINT checkMob…