English 中文(简体)
NHibernate 3.3:<sql-insert> Implement ancle 11g Deposit procedure
原标题:NHibernate 3.3: <sql-insert> executing an Oracle 11g stored procedure

I m 绘制甲骨质11g储存程序图,作为NHibernate s.hbm.xml绘图档案的指挥系统。

  <class name="Person" table="PERSONS">
    <id name="Id" column="COD_PERSON" />
    <property name="Name" column="NAME" />

    <property name="AuditField1" column="AUDITFIELD1" />
    <property name="AuditField2" column="AUDITFIELD2" />
    <property name="AuditField3" column="AUDITFIELD3" />

    <sql-insert>exec PKG_PERSONS.insert_sp ?,?</sql-insert>
  </class>

This is the stored procedure:

create or replace package body PKG_PERSONS is
  procedure insert_sp(pcod_person  persons.cod_person%type, 
                      pname        persons.name%type) is
  begin
    insert into persons(cod_person, name) values(pcod_person, pname);
  end;

从这一绘图中,Im期望Id和名称特性会作为参数发送,但肯定会发生这种情况;我把这一错误从Oracle带走:ORA-01036:非法变量名称/编号。 NHibernate显示了康索尔窗口的一些标志,似乎同NH一样试图绘制包括审计领域在内的所有财产图,以采用所储存的程序。

Maybe is this the source s error?

这一预期行为吗?

能否具体确定哪些财产作为NH3/ Oracle的参数?

提前感谢。

最佳回答

经确认,国家卫生局试图作为参数发送每个实体,其财产分布图如下:<代码><sql-insert>/<sql-update>储存程序,但你可以例外插入/更新日期=false。

另一个问题是执行Oracle11g储存程序的右轴,这是与NH3.3和Oracle一起为我工作的地图。 数据:4.112.2.0:

  <class name="Person" table="PERSONS">
    <id name="Id" column="COD_PERSON" />
    <property name="Name" column="NAME" />

    <property name="AuditField1" column="AUDITFIELD1" insert="false" update="false" />
    <property name="AuditField2" column="AUDITFIELD2" insert="false" update="false" />
    <property name="AuditField3" column="AUDITFIELD3" insert="false" update="false" />

    <sql-insert check="none">begin PKG_PERSONS.insert_sp(:p0,:p1); end;</sql-insert>
  </class>

I had to redefine the parameter s order, because Id property is send at last position:

create or replace package body PKG_PERSONS is
  procedure insert_sp(pname        persons.name%type,
                      pcod_person  persons.cod_person%type
                      ) is
  begin
    insert into persons(cod_person, name) values(pcod_person, pname);
  end;

Maybe this will help somebody else, Thanks.

问题回答

暂无回答




相关问题
Export tables from SQL Server to be imported to Oracle 10g

I m trying to export some tables from SQL Server 2005 and then create those tables and populate them in Oracle. I have about 10 tables, varying from 4 columns up to 25. I m not using any constraints/...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

How to make a one to one left outer join?

I was wondering, is there a way to make a kind of one to one left outer join: I need a join that matches say table A with table B, for each record on table A it must search for its pair on table B, ...

Insert if not exists Oracle

I need to be able to run an Oracle query which goes to insert a number of rows, but it also checks to see if a primary key exists and if it does, then it skips that insert. Something like: INSERT ALL ...

How can I store NULLs in NOT NULL field?

I just came across NULL values in NOT-NULL fields in our test database. How could they get there? I know that NOT-NULL constraints can be altered with NOVALIDATE clause, but that would change table s ...

Type reference scope

I m studying databases and am currently working on a object-relational DB project and I ve encountered a small problem with the number of possible constraints in an object table. I m using "Database ...

OracleParameter and DBNull.Value

we have a table in an Oracle Database which contains a column with the type Char(3 Byte). Now we use a parameterized sql to select some rows with a DBNull.Value and it doesn t work: OracleCommand ...

热门标签