oracle pl/sql ve hibernate arasinda array tiplerle ishlemek


oracle pl/sql prosedurlarla ishleyerken bazada yaradilan custom array typelarla(base integer ve ya stringden ibaretdir) ishleyerken java terefde problem olur , HikaryDataSoruce da arraylar createArrayOf ile yaranir  , oracle ise ancaq createArray ile yaradilan array typelari qebul edir . bu problemi hell etmek uchun:

    public OracleConnection getOracleConnection() {

        Connection conn = oracleDb().getConnection();

        return conn.unwrap(OracleConnection.class);

    }

Array prodCodes = getOracleConnection.createArray("BACK.T_STR_COLL", request.getProdCodes());

array i bazaya oturmemishden evvel OracleConnection u almaq lazimdir bunu da yuxarida olan kod ile almaq olur , daha sonra ui dan oturulen arrayi javada OracleConnectionun createArray metodu ile yaradib o formada bazaya oturmek lazimdir

burada SimpleJdbcCall vasitesile oracle pl/sql proseduru chagirilir , nece chagirilmagi docda var:

https://docs.spring.io/spring-data/jdbc/old-docs/2.0.0.M1/reference/html/orcl.datatypes.html

bu problem spring data jpa ile ishleyerken de bash verir onu hell etmek uchun hibernatein import org.hibernate.usertype.UserType; interfaceini implement ederek oracle pl/sql uchun custom array type yaratmaq olar + custom type larla ishlemek uchun hibenate a destek uchun implementation 'com.vladmihalcea:hibernate-types-52:2.7.0' bu libraryde var

Comments

Popular posts from this blog

Installation instructions for some programs on linux ubuntu

Hibernate and Application Performance

timezone ile bagli Jackson deserializableda problem