Mapping JPA entities As out parameters using hibernate

Hi , I have a stored procedure as follows

CREATE OR REPLACE PACKAGE BODY Pkg_name
IS

PROCEDURE proceure_Name (
Id             IN     Long,
startDate   IN     DATE,
EndDate     IN     DATE,

Table1     OUT    Table1_Name%ROWTYPE,
Table2   OUT    Table2_Name%ROWTYPE,
errormsg           OUT    VARCHAR2)
IS

Record another_Table%ROWTYPE;

I am using my test class to call this procedure
@Test
public void procedure9_2() throws ParseException, HibernateException {

    SessionFactory sessionFactory = this.getEntityManager().unwrap(Session.class).getSessionFactory();
    EntityManager em = sessionFactory.createEntityManager();
    Long id = 417478732001288L;
    Date startDate = setDateTime("08/31/2023 00:00:00");
    Date endDate = setDateTime("09/01/2018 00:00:00");
  

    String errorMsg = null;
    try (Session session = sessionFactory.openSession()) {
        session.getTransaction().begin();
        ProcedureCall call = session
                .createStoredProcedureCall("package_name.procedure_name");

        call.registerParameter(1, Long.class, ParameterMode.IN);
        call.registerParameter(2, Date.class, ParameterMode.IN);
        call.registerParameter(3, Date.class, ParameterMode.IN);
        call.registerParameter(4, Table1_Name.class, ParameterMode.OUT);
        call.registerParameter(5, Table1_Name.class, ParameterMode.OUT);
        call.registerParameter(6, String.class, ParameterMode.OUT);
        call.setParameter(1, id);
        call.setParameter(2, startDate);
        call.setParameter(3, startDate);

        System.out.println(call.getOutputs());

}

when I execute this I am getting
PLS-00306: wrong number or types of arguments in call to ‘procedure_name’
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to ‘procedure_name’
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Not sure where am I going wrong :frowning:
Pleasee helpp !

Hello, from the code you pasted it’s not clear what Table1_Name.class is but if that’s an entity, it’s not supported as an output stored procedure parameter type. You can look at Hibernate’s OutputableType interface to understand what’s supported as an output parameter for procedure calls, but basically it’s only basic types and components which are mapped as aggregates via @Struct.

yes you are right , it is an entity . So if my entity is as follows , there is no way I an map it as a parameter type ?

@Entity
@IdGeneratedBy15Digit
@Table(name=“Table_name”)

public class tableName extends BaseEntity {

/** The id. */
@Id
@FieldBusinessName("Id")
@Column(name = "ID", unique = true, precision = 15)
private Long id;