Unanswered Questions
153,566 questions with no upvoted or accepted answers
24
votes
1
answer
812
views
ODCIAggregateMerge without parallel_enabled
These are quotes from Oracle docs:
[Optional] Merge by combining the two aggregation contexts and return a single context. This operation combines the results of aggregation over subsets in order to ...
21
votes
1
answer
3k
views
How can I control the SQL table aliases that Hibernate uses in its generated queries?
tl;dr: Hibernate automatically generates SQL table aliases in its queries like jurisdicti4_ or this_. Here's an example query:
SELECT
this_.id AS id2_6_3_,
this_....
16
votes
2
answers
3k
views
How to map native sql results to oneToMany field with SqlResultSetMapping in JPA
For example, say I have the following database tables
Building
-----------
id
name
and
Room
-----------
id
roomNo
buildingId
the Building Java class will look something like
@Entity
public class ...
14
votes
1
answer
9k
views
How to create an empty array of struct in hive?
I have a view in Hive 1.1.0, based on a condition, it should return an empty array or an array of struct<name: string, jobslots: int>
Here is my code:
select
case when <condition>
...
14
votes
1
answer
13k
views
Check if the unique constraint exists and drop it using liquibase
I have a changeset wherein I initially check if the unique constraint exists and then if it does it will drop the constraint.
<changeSet author="loren"
id="...
12
votes
2
answers
7k
views
Choose a random row as aggregate function in Hive
I want to group by a column and then select random rows from another column. In Presto, there's arbitrary.
E.g. my query is:
SELECT a, arbitrary(b)
FROM foo
GROUP BY a
How do I do this in Hive?
...
11
votes
1
answer
873
views
Insert intention lock causes deadlock with composite primary key
I would like to ask for help :)
Two INSERT statements are issued simultaneously by 2 users into a doctrine-generated many-to-many table:
INSERT INTO my_table (col1, col2) VALUES (2271885, 16678); <-...
11
votes
3
answers
5k
views
Sequelize query with a where clause on an include of an include
I'm struggling to create a query with sequelize.
Some context
I have the following models:
A Manifestation can have [0..n] Event
An Event belongs to one Manifestation (an Event cannot exist without ...
11
votes
1
answer
9k
views
How use JSON_ARRAYAGG in JSON_OBJECT without escaping content
I have a SQL query that returns a JSON array. I want to simplify it using the native JSON functions of MySQL/MariaDB.
The sub-array sub-request is analysed as a string of characters.
How do I make the ...
10
votes
2
answers
750
views
How to fetch all rows which will be removed on using cascading delete before delete query
What is the best approach to fetch all the rows, which will be deleted on cascade of primary key?
At present we know the list of tables which uses the primary key as foreign key, a simple select query ...
10
votes
3
answers
15k
views
Missing comma before start of a new alter operation. (near "CHARACTER SET")
Mysql - phpmyadmin
What's wrong with this query?
ALTER TABLE `invoices`
CHANGE `status` `status` ENUM('paid','due','canceled','partial','cheque')
CHARACTER SET `utf8` COLLATE `utf8_general_ci` NOT ...
10
votes
2
answers
572
views
StoredProcedureCall 1x Varchar output 1x Cursor output
My question is maybe a little bit confusing. I have the problem that I'm calling an procedure with StoredProcedureCall from Java e.g.:
StoredProcedureCall call = new StoredProcedureCall();
call....
10
votes
1
answer
2k
views
Doctrine Filter in WHERE clause instead LEFT JOIN
I have a multi tenant application and i'm using the Doctrine Filters to filter my SQL by client.
So, when i want a list of my client Projects i just need to do a "getAll" and the filter will ...
10
votes
1
answer
2k
views
Hibernate duplicate primary key on restart using GenerationType.TABLE
We're running into an issue where we have Event subclasses that use GenerationType.TABLE to generate the primary key, and when we restart the servers we are getting duplicate primary key errors.
We'...
10
votes
2
answers
787
views
JPQL Constructor Expressions, how to eagerly fetch the main entity in 'select new'
The original query I have is somewhat complex, but what I'm trying to do is obtain the entity AlertCondition plus some additional fields.
+ " SELECT new org.rhq.core.domain.alert.composite....