I've got classes with mappings like this:
@Entity
public class CurrencyTable {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@Version
@Column(nullable=false)
private Timestamp version;
@Column(length=32, unique=true)
private String refCode;
@OneToMany(mappedBy="currencyTab...
We have a Hibernate based system with Annotations.
Our entities have a custom property DELETED.
We have to select non deleted entities with non deleted sub-entities.
How can we can do it?
Little sample for describe the situation:
GenericEntity {
...
@Basic
@Column(name = DELETED)
protected Boolean deleted = false;
@...
If I have an ajax call off fetching (with a callback) and then some other code running in the meantime. How can I have a third function that will be called when both of the first 2 are done. I'm sure it is easy with polling (setTimeout and then check some variables) but I'd rather a callback.
Is it possible?
...
Hibernate persistence class:
@Entity
public class A {
@OneToMany(mappedBy = "a")
private Set<B> bSet = new HashSet<B>();
@Basic
private boolean DELETED;
}
Class B also have a DELETED property. How can we process DELETED property during join automatically, for select only not deleted entities.
May be with hel...
I am using PHP and MySQL. In my program there is a select query involving joins. When I run it on localhost it's working fine but when I upload it on my server and try to execute it then it generates the following error:
The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_...
I have a data setup of the following form: State 1->n County 1->n City.
Within my State object, I want to return all counties that contain at least one city with a population greater than p. Were I to write this in sql it would be:
select distinct co.*
from County co join City ci on ci.CountyID = co.ID
where ci.Population > @p
and co....
How can you do a full outer join in sqlserver 2005?
Seems like there is full outer join in sqlserver 2008 but I need to do this in sqlserver 2005.
In other words, I am merging two views based on the ACCTNUM col in both views (The views show aggregates so there is at most one ACCTNUM record in each view for each account) and I would ...
Could I run the query:
Select id, (
select count(*) from tableA as a where a.value < a.id
)
from tableA as a where id < 5
and get the results I wanted. If not is there a way to do the same thing without having to do 2 querys?
...
Hi all,
I want to combine 2 tables into one. Let say I have:
Table1
ID Name
1 A
2 B
3 C
Table2
ID Name
4 D
5 E
6 F
I want to make Table3
Name1 Name2
A D
B E
C F
How can I do this in SQL Server? Any help is greatly appreciated.
...
Here is a seemingly simple problem: given a list of iterators that yield sequences of integers in ascending order, write a concise generator that yields only the integers that appear in every sequence.
After reading a few papers last night, I decided to hack up a completely minimal full text indexer in Python, as seen here (though that ...
I have these tables:
media table - id int primary key, uri varchar.
media_to_people - media_id int primary key, people_id int primary key
people - id int primary key, name varchar, role int -- role specifies whether the person is an artist, publisher, writer, actor, etc relative to the media and has range(1-10)
This is a many to many r...
Lets say I have two tables(A, B) like:
A {id, a, c}
B {id, b, c}
I have also their entities. I want to write an HQL so that the result set will be like (where A.c = B.c):
(a1, b1, c1)
(a2, b2, c2)
(a3, b3, c3)
...
Since on clauses are not supported by hibernate I am stuck and I don't know how to write the query.
...
This is the first time I've used NHibernate for a big project so bear with me. Basically, I need to run a search based on 5 fields.
I want to display the results in a table. Here is a test I've written that basically gets all Clients that have Intakes with a Staff named "DII". When I run it, I get an error saying that some of the I...
Summary
I've got a table of items that go in pairs. I'd like to self-join it so I can retrieve both sides of the pair in a single query. It's valid SQL (I think), the SQLite engine actually does accept it, but I'm having trouble getting DBIx::Class to bite the bullet.
Minimal example
package Schema;
use parent 'DBIx::Class::Schema';...
I have two files where I want to perform union operation
based on 1st column:
file1.txt
foo 1
bar 2
qux 3
file2.txt
foo x
qux y
boo z
The result I hope to get is like this:
foo 1 x
bar 2 -
qux 3 y
boo - z
where the empty fields of column 1 is padded
with "-".
But why this join command doesn't work as I expected?
$ join -a...
I have two tables:
Clients, and a join table that has user id, a foreign key to clients, and some other stuff.
I want to do this SQL
select TblClient.* from TblClient
inner join tblUserClientProjJoin as b on TblClient.Client_ID = b.Client_FK
where b.User_fk = 2
So getting a list of 'clients' that a specific user has access to.
I w...
I have a common database joining situation involving three tables. One table, A, is the main table with a primary key named id. Tables B and C contain auxiliary data for entries and A, and each also has a column named id which is a foreign key pointing to A.id. Now, if I want all data from A, B and C in one query, I would write:
SELECT ...
I have two tables that holds inforamtion for SKU.
Log table has datetimefield 2008-10-26 06:21:59.820
the other table has datetimefield 2008-10-26 06:22:02.313
I want to include this datetime fields in join for these 2 tables.
Is it possible to join to tables with datetime fields that has difference not more than 3 seconds? What is the ...
Hi,
I'm trying to create a SQL 2005 query to retrieve and combine records from 3 SCCM Data Views.
The first view contains records of valid PC's; the second contains logon-information containing: PC-id, username, timestamp, etc; the third contains PC-id, IP-address.
The 1stview only contains a single, nique record per PC; the 2nd view ca...
How do you join two data tables from different source databases in .NET? Ideally, I can craft two queries manually and simply join on a single field.
In this case, linked servers and scheduled imports are not an option. I've looked into the data relation object, but (correct me if I'm wrong) that only works for parent-child relationshi...