Ich habe zwei Tabellen:
-- Table: medibv.btdbn
-- DROP TABLE medibv.btdbn;
CREATE TABLE medibv.btdbn
(
mabn varchar(8) NOT NULL,
hoten text,
ngaysinh timestamp,
namsinh varchar(4),
phai numeric(1) DEFAULT 0,
mann varchar(2),
madantoc varchar(2),
sonha varchar(15),
thon text,
cholam text,
matt varchar(3),
maqu varchar(5),
maphuongxa varchar(7),
userid numeric(5) DEFAULT 0,
ngayud timestamp DEFAULT now(),
hotenkdau text,
nam text,
image bytea,
barcode bytea,
CONSTRAINT pk_btdbn PRIMARY KEY (mabn) USING INDEX TABLESPACE medi_index,
CONSTRAINT fk_btdbn_btddt FOREIGN KEY (madantoc)
REFERENCES medibv.btddt (madantoc) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT fk_btdbn_btdnn_bv FOREIGN KEY (mann)
REFERENCES medibv.btdnn_bv (mann) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT fk_btdbn_btdpxa FOREIGN KEY (maphuongxa)
REFERENCES medibv.btdpxa (maphuongxa) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT fk_btdbn_btdquan FOREIGN KEY (maqu)
REFERENCES medibv.btdquan (maqu) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT fk_btdbn_btdtt FOREIGN KEY (matt)
REFERENCES medibv.btdtt (matt) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL
)
WITH OIDS;
ALTER TABLE medibv.btdbn OWNER TO medisoft;
und
-- Table: medibv.benhandt
-- DROP TABLE medibv.benhandt;
CREATE TABLE medibv.benhandt
(
mabn varchar(8),
mavaovien numeric(18) DEFAULT 0,
maql numeric(18) NOT NULL DEFAULT 0,
makp varchar(2),
ngay timestamp,
dentu numeric(1) DEFAULT 0,
nhantu numeric(1) DEFAULT 0,
lanthu numeric(3) DEFAULT 0,
madoituong numeric(2) DEFAULT 0,
chandoan text,
maicd varchar(9),
mabs varchar(4),
sovaovien varchar(10),
loaiba numeric(3) DEFAULT 0,
userid numeric(5) DEFAULT 0,
ngayud timestamp DEFAULT now(),
cschandoan text,
CONSTRAINT pk_benahndt PRIMARY KEY (maql),
CONSTRAINT fk_benhandt_btdkp_bv FOREIGN KEY (makp)
REFERENCES medibv.btdkp_bv (makp) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT fk_benhandt_doituong FOREIGN KEY (madoituong)
REFERENCES medibv.doituong (madoituong) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL
)
WITH OIDS;
ALTER TABLE medibv.benhandt OWNER TO medisoft;
Ich habe NHibernate mit C# verwendet und zwei Klassen erstellt: Btdbn
y Benhandt
Ich möchte eine Ilist
wie untenstehende Sql:
hql= "select tdbn.mabn, badt.mavaovien " +
"from btdbn tdbn " +
" inner join benhandt badt on tdbn.mabn = badt.mabn";