Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Santosh Ghatage is currently offline Santosh GhatageFriend
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.

Re: Stored procedure call does not work with entity object [message #1841841 is a reply to message #1841835] Tue, 01 June 2021 06:36 Go to previous message
Radek Felcman is currently offline Radek FelcmanFriend
Messages: 19
Registered: March 2021
Junior Member
Maybe as a helper check
https://github.com/eclipse-ee4j/eclipselink/blob/master/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/plsql/PLSQLTestSuite.java
https://github.com/eclipse-ee4j/eclipselink/blob/master/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/models/jpa/plsql/Employee.java
Previous Topic:JAXB/Moxy Unmarshalling assigns all field values to Map<String,Object> rather than the specifi
Next Topic:EclipseLink perfomance issue (QueryImpl)
Goto Forum:
  


Current Time: Fri Apr 19 02:20:09 GMT 2024

Powered by FUDForum. Page generated in 0.02608 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top