Home » Eclipse Projects » EclipseLink » Stored procedure call does not work with entity object
Stored procedure call does not work with entity object [message #1841835] |
Mon, 31 May 2021 19:28  |
Santosh Ghatage Messages: 1 Registered: May 2021 |
Junior Member |
|
|
I am trying to execute to stored procedure by passing Entity object but ends up with the following error
Internal Exception: java.sql.SQLException: invalid name pattern: STOCK_BU_V
Error Code: 17074
Call: BEGIN STOCK_PCK.BUUPD_PRC(PARAM1=>?); END;
bind => [1 parameter bound]
Query: DataReadQuery()] with root cause
java.sql.SQLException: invalid name pattern: STOCK_BU_V
at oracle.jdbc.oracore.OracleTypeADT.initMetadata12(OracleTypeADT.java:547) ~[ojdbc8-12.2.0.1.jar:12.2.0.1.0]
I added the @Struct annotation and gave it the name of the matching oracle object from the Database., I have also added the @Entity annotation but still get the same error.
My Entity looks as following
@NamedStoredProcedureQuery(name = "BuUpd_Prc",
procedureName = "STOCK_PCK.BuUpd_Prc",
resultClasses={StockBuVEntity.class},
parameters = {
// @StoredProcedureParameter(queryParameter = "inParam1", jdbcType = OracleTypes.STRUCT, jdbcTypeName = "STOCK_BU_V"),
@StoredProcedureParameter(queryParameter = "inParam1",jdbcType = OracleTypes.STRUCT, mode=ParameterMode.IN),
@StoredProcedureParameter(queryParameter = "outParam1", mode=ParameterMode.OUT, jdbcType = OracleTypes.STRUCT)
})
@Embeddable
@Struct(name = "STOCK_BU_V", fields = {"bu_tk", "clt_class", "clut_type","clu_code","NAME", "name_short", "respa_code", "exclude_intranet", "fict_unit", "external_source", "external_id","user_comment",
"user_id", "upd_date", "valid_from","valid_to"})
@Entity
@Table(name = "STOCK_BU_V")
public class StockBuVEntity{
private Integer buTk;
private String cltClass;
private String clutType;
private String cluCode;
private String name;
private String nameShort;
private String respaCode;
private String excludeIntranet;
private String fictUnit;
private String externalSource;
private String externalId;
private String userComment;
private String userId;
private Time updDate;
private Time validFrom;
private Time validTo;
private Long versionNo;
private String updValidTo;
private Long versionNoSeqno;
private String cluSeqno;
.....
}
And my executor code looks as following
StoredProcedureCall call = new StoredProcedureCall();
call.setProcedureName("STOCK_PCK.BUUPD_PRC");
call.addNamedArgument("PARAM1", "PARAM1", Types.STRUCT, "STOCK_BU_V", StockBuVEntity.class);
DataReadQuery dataReadQuery = new DataReadQuery(call);
dataReadQuery.addArgument("PARAM1");
List<Cbdfbu01BuVEntity> data = new ArrayList<>();
data.add(StockBuVEntity);
Object result = ((EntityManagerImpl)entityManager.getDelegate()).getSession().executeQuery(dataReadQuery,data);
return (StockBuVEntity) result;
I think the reason my error is that @Struct is not identifying the entity object. Could someone help on how I can check if the @Struct is mapping the entity object.
|
|
| |
Goto Forum:
Current Time: Wed Jun 07 04:51:34 GMT 2023
Powered by FUDForum. Page generated in 0.02025 seconds
|