Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hi, guru! I'm new to hibernate, I read a lot of posts on stored procedure, still cannot gain how to access a simple stored procedure in java.
Hibernate version:3.3.1.GA 
1,a simple table:
Code:
CREATE TABLE [dbo].[T_SEQUENCE](
   [Name] [varchar](100) NOT NULL,
   [SEQN] [int] IDENTITY(100,1) NOT NULL
) ON [PRIMARY]
2,a simple stored procedure:
Code:
ALTER Procedure [dbo].[SP_GetSeqn] 
   @seqn int output
AS
Begin
   delete from t_sequence;
   insert into T_SEQUENCE(name) values('aaa');
   select @seqn = SCOPE_IDENTITY() ;
End
3,does this mapping correct?
Code:
<hibernate-mapping>
    <sql-query name="SP_GetSeqn" callable="true">
        <return-scalar type="int" column="seqn"/>
        {? = call SP_GetSeqn() }
    </sql-query>
</hibernate-mapping>
4,how to set output parameter? how to get the result?
Code:
Query  query =  session.getNamedQuery("SP_GetSeqn");
...
5,thank you very much!