-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: SQLInsert annotation with stored procedure
PostPosted: Thu Oct 09, 2008 2:15 pm 
Newbie

Joined: Thu Oct 09, 2008 1:54 pm
Posts: 1
I have a situation where I need to call a stored procedure when inserting data. We are heavily using annotations on this project so I definitely would like to use them for this situation. I have read up on the @SQLInsert annotation and I think it might work for me however I can't figure out the following:

1. How do I tell Hibernate which parameters are input parameters and which ones are output parameters?

2. How do I tell Hibernate in which order to pass the input parameters?

Below is hopefully enough information from my class to help you understand what I'm doing:

@SQLInsert(callable = true, sql = "call outbound_transaction_add_update(?, ?, ?, ?, ?, ?, ?, ?, ?)")
public class OutboundTransaction implements Timestampable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "outbound_transaction_id")
private Integer id;

@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST }, fetch = FetchType.LAZY)
@JoinColumn(name = "hcp_id")
private HealthCareProvider provider;

@Type(type = "EnumUserType", parameters = { @Parameter(name = "enumType", value = "OutboundTransactionType") })
@Column(name = "dict_outbound_transaction_type_code")
private OutboundTransactionType type;

@Column(name = "outbound_transaction_request_id")
private Integer outboundRequestId;

@Type(type = "EnumUserType", parameters = { @Parameter(name = "enumType", value = "OutboundTransactionStatus") })
@Column(name = "dict_transaction_status_code")
private OutboundTransactionStatus status;

@Column(name = "outbound_transaction_status_msg_str")
private String statusMessage;

@Column(name = "outbound_transaction_error_code")
private String errorCode;

@Column(name = "outbound_transaction_error_msg")
private String errorMessage;

private EntityTimestamp entityTimestamp;
}


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 05, 2008 6:16 am 
Newbie

Joined: Wed Nov 05, 2008 6:13 am
Posts: 1
I've got exactly the same situation.

Thanks in advance if somebody would explain it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.