Unable to call Oracle stored Function which returns a CLOB using myBatis spring

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Unable to call Oracle stored Function which returns a CLOB using myBatis spring

Paresh Joshi
Hi I am trying to call a Oracle Stored Function using MyBatis 3.4 and Spring 4.2.  The Oracle stored function takes 2 VARCHAR input parameters and returns a CLOB, but the output clob always returns NULL and throws NullPointerException. I am not sure what is missing. I would really appreciate your help.

Following is the mapper.xml file -

<mapper namespace = "com.example.AuthorizationMapper">

   <select id="getAuthorizations" parameterType="map" resultType="java.sql.Clob" statementType="CALLABLE">


<!--       { #{authString, mode=OUT, jdbcType=CLOB} = call pkg_fims_security.fnc_select_user(#{userName, mode=IN, jdbcType=VARCHAR},
      #{credentials, mode=IN, jdbcType=VARCHAR})} -->

      DECLARE
   authString CLOB;
  BEGIN
   authString := PKG_ABC.FNC_SELECT_USER(#{userName, mode=IN, jdbcType=VARCHAR},
      #{credentials, mode=IN, jdbcType=VARCHAR});
  END;
   </select>
</mapper>


AuthorizationMapper.java -


public interface AuthorizationMapper
{
 Clob getAuthorizations(@Param("userName") String userName, @Param("credentials") String credentials);
}



AuthorizationServiceImpl.java -

@Service("authorizationService")
@Transactional("oraTransactionManager")
public class AuthorizationServiceImpl implements AuthorizationService {
 
 @Autowired
 private AuthorizationMapper authorizationMapper;
 public String getAuthorizations(String userName, String credentials) {
 
  Clob clob = authorizationMapper.getAuthorizations(userName, credentials);
  if(clob==null)
   System.out.println("*********** Clob is empty");
  
  String authorizationsList = getStringFromInputString(clob);
  
  
  if(authorizationsList!=null)) {
  
   System.out.println("authorizations is NOT NULL");
   
   return authorizationsList;
  }
  else {
   System.out.println("in ServiceImpl : authorizations is empty");
   return null;
  }
  
 }
 
 private String getStringFromInputString(Clob clob){
 
        StringBuffer sb = null;
        Reader rdr = null;
        String authorizeStr = null;
        try {
            rdr = clob.getCharacterStream();
            int size = (int) clob.length();
            char buffer[] = new char[size];
            int length;
                sb = new StringBuffer();
            while ((length = rdr.read(buffer,0,size)) != -1 ) {
                sb.append( buffer, 0, length );
            }
            authorizeStr = sb.toString();
 }catch(Exception e){
  System.out.println("Error occurred :"+e.getMessage());
 
  e.printStackTrace(System.out);
 }
        return authorizeStr;
 }

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to call Oracle stored Function which returns a CLOB using myBatis spring

Iwao AVE!
Hi,

Have you tried changing the return type of
AuthorizationMapper#getAuthorizations method to String?
There is a built-in ClobTypeHandler that converts CLOB to String automatically.

Regards,
Iwao

2016-08-02 3:00 GMT+09:00 Paresh Joshi <[hidden email]>:

> Hi I am trying to call a Oracle Stored Function using MyBatis 3.4 and Spring
> 4.2.  The Oracle stored function takes 2 VARCHAR input parameters and
> returns a CLOB, but the output clob always returns NULL and throws
> NullPointerException. I am not sure what is missing. I would really
> appreciate your help.
>
> Following is the mapper.xml file -
>
> <mapper namespace = "com.example.AuthorizationMapper">
>
>    <select id="getAuthorizations" parameterType="map"
> resultType="java.sql.Clob" statementType="CALLABLE">
>
>
> <!--       { #{authString, mode=OUT, jdbcType=CLOB} = call
> pkg_fims_security.fnc_select_user(#{userName, mode=IN, jdbcType=VARCHAR},
>       #{credentials, mode=IN, jdbcType=VARCHAR})} -->
>
>       DECLARE
>    authString CLOB;
>   BEGIN
>    authString := PKG_ABC.FNC_SELECT_USER(#{userName, mode=IN,
> jdbcType=VARCHAR},
>       #{credentials, mode=IN, jdbcType=VARCHAR});
>   END;
>    </select>
> </mapper>
>
>
> AuthorizationMapper.java -
>
>
> public interface AuthorizationMapper
> {
>  Clob getAuthorizations(@Param("userName") String userName,
> @Param("credentials") String credentials);
> }
>
>
>
> AuthorizationServiceImpl.java -
>
> @Service("authorizationService")
> @Transactional("oraTransactionManager")
> public class AuthorizationServiceImpl implements AuthorizationService {
>
>  @Autowired
>  private AuthorizationMapper authorizationMapper;
>  public String getAuthorizations(String userName, String credentials) {
>
>   Clob clob = authorizationMapper.getAuthorizations(userName, credentials);
>   if(clob==null)
>    System.out.println("*********** Clob is empty");
>
>   String authorizationsList = getStringFromInputString(clob);
>
>
>   if(authorizationsList!=null)) {
>
>    System.out.println("authorizations is NOT NULL");
>
>    return authorizationsList;
>   }
>   else {
>    System.out.println("in ServiceImpl : authorizations is empty");
>    return null;
>   }
>
>  }
>
>  private String getStringFromInputString(Clob clob){
>
>         StringBuffer sb = null;
>         Reader rdr = null;
>         String authorizeStr = null;
>         try {
>             rdr = clob.getCharacterStream();
>             int size = (int) clob.length();
>             char buffer[] = new char[size];
>             int length;
>                 sb = new StringBuffer();
>             while ((length = rdr.read(buffer,0,size)) != -1 ) {
>                 sb.append( buffer, 0, length );
>             }
>             authorizeStr = sb.toString();
>  }catch(Exception e){
>   System.out.println("Error occurred :"+e.getMessage());
>
>   e.printStackTrace(System.out);
>  }
>         return authorizeStr;
>  }

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to call Oracle stored Function which returns a CLOB using myBatis spring

Rick R


On Tue, Aug 9, 2016 at 9:05 PM, Iwao AVE! <[hidden email]> wrote:
Hi,

Have you tried changing the return type of
AuthorizationMapper#getAuthorizations method to String?
There is a built-in ClobTypeHandler that converts CLOB to String automatically.

I have not. Never even hear of it. Any examples/documentation of that (a quick google search didn't help) ? 

I've just always configured the mapper columns for clobs like I have done throughout the years without issues...

<result column="XML_DESCR" property="xmlDef" jdbcType="CLOB" javaType="java.lang.String" /> 

and again, what is odd is why it works fine 99.99% of the time. This is the first time we've seen an issue. I just don't get why using MyBatis for the mapping has an issue this particular case, but straight JDBC does not.

Thanks Iwao




Regards,
Iwao

2016-08-02 3:00 GMT+09:00 Paresh Joshi <[hidden email]>:
> Hi I am trying to call a Oracle Stored Function using MyBatis 3.4 and Spring
> 4.2.  The Oracle stored function takes 2 VARCHAR input parameters and
> returns a CLOB, but the output clob always returns NULL and throws
> NullPointerException. I am not sure what is missing. I would really
> appreciate your help.
>
> Following is the mapper.xml file -
>
> <mapper namespace = "com.example.AuthorizationMapper">
>
>    <select id="getAuthorizations" parameterType="map"
> resultType="java.sql.Clob" statementType="CALLABLE">
>
>
> <!--       { #{authString, mode=OUT, jdbcType=CLOB} = call
> pkg_fims_security.fnc_select_user(#{userName, mode=IN, jdbcType=VARCHAR},
>       #{credentials, mode=IN, jdbcType=VARCHAR})} -->
>
>       DECLARE
>    authString CLOB;
>   BEGIN
>    authString := PKG_ABC.FNC_SELECT_USER(#{userName, mode=IN,
> jdbcType=VARCHAR},
>       #{credentials, mode=IN, jdbcType=VARCHAR});
>   END;
>    </select>
> </mapper>
>
>
> AuthorizationMapper.java -
>
>
> public interface AuthorizationMapper
> {
>  Clob getAuthorizations(@Param("userName") String userName,
> @Param("credentials") String credentials);
> }
>
>
>
> AuthorizationServiceImpl.java -
>
> @Service("authorizationService")
> @Transactional("oraTransactionManager")
> public class AuthorizationServiceImpl implements AuthorizationService {
>
>  @Autowired
>  private AuthorizationMapper authorizationMapper;
>  public String getAuthorizations(String userName, String credentials) {
>
>   Clob clob = authorizationMapper.getAuthorizations(userName, credentials);
>   if(clob==null)
>    System.out.println("*********** Clob is empty");
>
>   String authorizationsList = getStringFromInputString(clob);
>
>
>   if(authorizationsList!=null)) {
>
>    System.out.println("authorizations is NOT NULL");
>
>    return authorizationsList;
>   }
>   else {
>    System.out.println("in ServiceImpl : authorizations is empty");
>    return null;
>   }
>
>  }
>
>  private String getStringFromInputString(Clob clob){
>
>         StringBuffer sb = null;
>         Reader rdr = null;
>         String authorizeStr = null;
>         try {
>             rdr = clob.getCharacterStream();
>             int size = (int) clob.length();
>             char buffer[] = new char[size];
>             int length;
>                 sb = new StringBuffer();
>             while ((length = rdr.read(buffer,0,size)) != -1 ) {
>                 sb.append( buffer, 0, length );
>             }
>             authorizeStr = sb.toString();
>  }catch(Exception e){
>   System.out.println("Error occurred :"+e.getMessage());
>
>   e.printStackTrace(System.out);
>  }
>         return authorizeStr;
>  }

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.



--
Rick R

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to call Oracle stored Function which returns a CLOB using myBatis spring

Rick R
Ok, I looked at the source code and I noticed MyBatis using this to get the Clob value:

int size = (int) clob.length();
value = clob.getSubString(1, size);
When I do this with JDBC I  DO get the error in the parsing of the CLOB as well (so that's good)   I was doing this via JDBC, which case the XML comes back correctly:
GOOD:
Reader is = clob.getCharacterStream();
StringBuffer sb = new StringBuffer();
int length = (int) clob.length();
char[] buffer = new char[length];
while (is.read(buffer) != -1) {
sb.append(buffer);
}
value = sb.toString();

I'm not sure what's causing the difference but the latter works. Is this a bug? I can create my own CLOB handler to do this but should the core code maybe be updated?


On Tue, Aug 9, 2016 at 9:52 PM, Rick R <[hidden email]> wrote:


On Tue, Aug 9, 2016 at 9:05 PM, Iwao AVE! <[hidden email]> wrote:
Hi,

Have you tried changing the return type of
AuthorizationMapper#getAuthorizations method to String?
There is a built-in ClobTypeHandler that converts CLOB to String automatically.

I have not. Never even hear of it. Any examples/documentation of that (a quick google search didn't help) ? 

I've just always configured the mapper columns for clobs like I have done throughout the years without issues...

<result column="XML_DESCR" property="xmlDef" jdbcType="CLOB" javaType="java.lang.String" /> 

and again, what is odd is why it works fine 99.99% of the time. This is the first time we've seen an issue. I just don't get why using MyBatis for the mapping has an issue this particular case, but straight JDBC does not.

Thanks Iwao




Regards,
Iwao

2016-08-02 3:00 GMT+09:00 Paresh Joshi <[hidden email]>:
> Hi I am trying to call a Oracle Stored Function using MyBatis 3.4 and Spring
> 4.2.  The Oracle stored function takes 2 VARCHAR input parameters and
> returns a CLOB, but the output clob always returns NULL and throws
> NullPointerException. I am not sure what is missing. I would really
> appreciate your help.
>
> Following is the mapper.xml file -
>
> <mapper namespace = "com.example.AuthorizationMapper">
>
>    <select id="getAuthorizations" parameterType="map"
> resultType="java.sql.Clob" statementType="CALLABLE">
>
>
> <!--       { #{authString, mode=OUT, jdbcType=CLOB} = call
> pkg_fims_security.fnc_select_user(#{userName, mode=IN, jdbcType=VARCHAR},
>       #{credentials, mode=IN, jdbcType=VARCHAR})} -->
>
>       DECLARE
>    authString CLOB;
>   BEGIN
>    authString := PKG_ABC.FNC_SELECT_USER(#{userName, mode=IN,
> jdbcType=VARCHAR},
>       #{credentials, mode=IN, jdbcType=VARCHAR});
>   END;
>    </select>
> </mapper>
>
>
> AuthorizationMapper.java -
>
>
> public interface AuthorizationMapper
> {
>  Clob getAuthorizations(@Param("userName") String userName,
> @Param("credentials") String credentials);
> }
>
>
>
> AuthorizationServiceImpl.java -
>
> @Service("authorizationService")
> @Transactional("oraTransactionManager")
> public class AuthorizationServiceImpl implements AuthorizationService {
>
>  @Autowired
>  private AuthorizationMapper authorizationMapper;
>  public String getAuthorizations(String userName, String credentials) {
>
>   Clob clob = authorizationMapper.getAuthorizations(userName, credentials);
>   if(clob==null)
>    System.out.println("*********** Clob is empty");
>
>   String authorizationsList = getStringFromInputString(clob);
>
>
>   if(authorizationsList!=null)) {
>
>    System.out.println("authorizations is NOT NULL");
>
>    return authorizationsList;
>   }
>   else {
>    System.out.println("in ServiceImpl : authorizations is empty");
>    return null;
>   }
>
>  }
>
>  private String getStringFromInputString(Clob clob){
>
>         StringBuffer sb = null;
>         Reader rdr = null;
>         String authorizeStr = null;
>         try {
>             rdr = clob.getCharacterStream();
>             int size = (int) clob.length();
>             char buffer[] = new char[size];
>             int length;
>                 sb = new StringBuffer();
>             while ((length = rdr.read(buffer,0,size)) != -1 ) {
>                 sb.append( buffer, 0, length );
>             }
>             authorizeStr = sb.toString();
>  }catch(Exception e){
>   System.out.println("Error occurred :"+e.getMessage());
>
>   e.printStackTrace(System.out);
>  }
>         return authorizeStr;
>  }

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.



--
Rick R



--
Rick R

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to call Oracle stored Function which returns a CLOB using myBatis spring

Rick R
I should have said it's good " in the sense that I can reproduce' the error via straight JDBC based on how MyBatis is getting the Clob value

Doesn't work (in all cases apparently):
int size = (int) clob.length();
value = clob.getSubString(1, size);

DOES work (albeit more verbose):
Reader is = clob.getCharacterStream();
StringBuffer sb = new StringBuffer();
int length = (int) clob.length();
char[] buffer = new char[length];
while (is.read(buffer) != -1) {
sb.append(buffer);
}
value = sb.toString();


On Tue, Aug 9, 2016 at 10:57 PM, Rick R <[hidden email]> wrote:
Ok, I looked at the source code and I noticed MyBatis using this to get the Clob value:

int size = (int) clob.length();
value = clob.getSubString(1, size);
When I do this with JDBC I  DO get the error in the parsing of the CLOB as well (so that's good)   I was doing this via JDBC, which case the XML comes back correctly:
GOOD:
Reader is = clob.getCharacterStream();
StringBuffer sb = new StringBuffer();
int length = (int) clob.length();
char[] buffer = new char[length];
while (is.read(buffer) != -1) {
sb.append(buffer);
}
value = sb.toString();

I'm not sure what's causing the difference but the latter works. Is this a bug? I can create my own CLOB handler to do this but should the core code maybe be updated?


On Tue, Aug 9, 2016 at 9:52 PM, Rick R <[hidden email]> wrote:


On Tue, Aug 9, 2016 at 9:05 PM, Iwao AVE! <[hidden email]> wrote:
Hi,

Have you tried changing the return type of
AuthorizationMapper#getAuthorizations method to String?
There is a built-in ClobTypeHandler that converts CLOB to String automatically.

I have not. Never even hear of it. Any examples/documentation of that (a quick google search didn't help) ? 

I've just always configured the mapper columns for clobs like I have done throughout the years without issues...

<result column="XML_DESCR" property="xmlDef" jdbcType="CLOB" javaType="java.lang.String" /> 

and again, what is odd is why it works fine 99.99% of the time. This is the first time we've seen an issue. I just don't get why using MyBatis for the mapping has an issue this particular case, but straight JDBC does not.

Thanks Iwao




Regards,
Iwao

2016-08-02 3:00 GMT+09:00 Paresh Joshi <[hidden email]>:
> Hi I am trying to call a Oracle Stored Function using MyBatis 3.4 and Spring
> 4.2.  The Oracle stored function takes 2 VARCHAR input parameters and
> returns a CLOB, but the output clob always returns NULL and throws
> NullPointerException. I am not sure what is missing. I would really
> appreciate your help.
>
> Following is the mapper.xml file -
>
> <mapper namespace = "com.example.AuthorizationMapper">
>
>    <select id="getAuthorizations" parameterType="map"
> resultType="java.sql.Clob" statementType="CALLABLE">
>
>
> <!--       { #{authString, mode=OUT, jdbcType=CLOB} = call
> pkg_fims_security.fnc_select_user(#{userName, mode=IN, jdbcType=VARCHAR},
>       #{credentials, mode=IN, jdbcType=VARCHAR})} -->
>
>       DECLARE
>    authString CLOB;
>   BEGIN
>    authString := PKG_ABC.FNC_SELECT_USER(#{userName, mode=IN,
> jdbcType=VARCHAR},
>       #{credentials, mode=IN, jdbcType=VARCHAR});
>   END;
>    </select>
> </mapper>
>
>
> AuthorizationMapper.java -
>
>
> public interface AuthorizationMapper
> {
>  Clob getAuthorizations(@Param("userName") String userName,
> @Param("credentials") String credentials);
> }
>
>
>
> AuthorizationServiceImpl.java -
>
> @Service("authorizationService")
> @Transactional("oraTransactionManager")
> public class AuthorizationServiceImpl implements AuthorizationService {
>
>  @Autowired
>  private AuthorizationMapper authorizationMapper;
>  public String getAuthorizations(String userName, String credentials) {
>
>   Clob clob = authorizationMapper.getAuthorizations(userName, credentials);
>   if(clob==null)
>    System.out.println("*********** Clob is empty");
>
>   String authorizationsList = getStringFromInputString(clob);
>
>
>   if(authorizationsList!=null)) {
>
>    System.out.println("authorizations is NOT NULL");
>
>    return authorizationsList;
>   }
>   else {
>    System.out.println("in ServiceImpl : authorizations is empty");
>    return null;
>   }
>
>  }
>
>  private String getStringFromInputString(Clob clob){
>
>         StringBuffer sb = null;
>         Reader rdr = null;
>         String authorizeStr = null;
>         try {
>             rdr = clob.getCharacterStream();
>             int size = (int) clob.length();
>             char buffer[] = new char[size];
>             int length;
>                 sb = new StringBuffer();
>             while ((length = rdr.read(buffer,0,size)) != -1 ) {
>                 sb.append( buffer, 0, length );
>             }
>             authorizeStr = sb.toString();
>  }catch(Exception e){
>   System.out.println("Error occurred :"+e.getMessage());
>
>   e.printStackTrace(System.out);
>  }
>         return authorizeStr;
>  }

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.



--
Rick R



--
Rick R



--
Rick R

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to call Oracle stored Function which returns a CLOB using myBatis spring

Rick R

crap sorry replied to wrong thread. my bad

Rick R
Sent from tablet


On Aug 9, 2016 11:29 PM, "Rick R" <[hidden email]> wrote:
I should have said it's good " in the sense that I can reproduce' the error via straight JDBC based on how MyBatis is getting the Clob value

Doesn't work (in all cases apparently):
int size = (int) clob.length();
value = clob.getSubString(1, size);

DOES work (albeit more verbose):
Reader is = clob.getCharacterStream();
StringBuffer sb = new StringBuffer();
int length = (int) clob.length();
char[] buffer = new char[length];
while (is.read(buffer) != -1) {
sb.append(buffer);
}
value = sb.toString();


On Tue, Aug 9, 2016 at 10:57 PM, Rick R <[hidden email]> wrote:
Ok, I looked at the source code and I noticed MyBatis using this to get the Clob value:

int size = (int) clob.length();
value = clob.getSubString(1, size);
When I do this with JDBC I  DO get the error in the parsing of the CLOB as well (so that's good)   I was doing this via JDBC, which case the XML comes back correctly:
GOOD:
Reader is = clob.getCharacterStream();
StringBuffer sb = new StringBuffer();
int length = (int) clob.length();
char[] buffer = new char[length];
while (is.read(buffer) != -1) {
sb.append(buffer);
}
value = sb.toString();

I'm not sure what's causing the difference but the latter works. Is this a bug? I can create my own CLOB handler to do this but should the core code maybe be updated?


On Tue, Aug 9, 2016 at 9:52 PM, Rick R <[hidden email]> wrote:


On Tue, Aug 9, 2016 at 9:05 PM, Iwao AVE! <[hidden email]> wrote:
Hi,

Have you tried changing the return type of
AuthorizationMapper#getAuthorizations method to String?
There is a built-in ClobTypeHandler that converts CLOB to String automatically.

I have not. Never even hear of it. Any examples/documentation of that (a quick google search didn't help) ? 

I've just always configured the mapper columns for clobs like I have done throughout the years without issues...

<result column="XML_DESCR" property="xmlDef" jdbcType="CLOB" javaType="java.lang.String" /> 

and again, what is odd is why it works fine 99.99% of the time. This is the first time we've seen an issue. I just don't get why using MyBatis for the mapping has an issue this particular case, but straight JDBC does not.

Thanks Iwao




Regards,
Iwao

2016-08-02 3:00 GMT+09:00 Paresh Joshi <[hidden email]>:
> Hi I am trying to call a Oracle Stored Function using MyBatis 3.4 and Spring
> 4.2.  The Oracle stored function takes 2 VARCHAR input parameters and
> returns a CLOB, but the output clob always returns NULL and throws
> NullPointerException. I am not sure what is missing. I would really
> appreciate your help.
>
> Following is the mapper.xml file -
>
> <mapper namespace = "com.example.AuthorizationMapper">
>
>    <select id="getAuthorizations" parameterType="map"
> resultType="java.sql.Clob" statementType="CALLABLE">
>
>
> <!--       { #{authString, mode=OUT, jdbcType=CLOB} = call
> pkg_fims_security.fnc_select_user(#{userName, mode=IN, jdbcType=VARCHAR},
>       #{credentials, mode=IN, jdbcType=VARCHAR})} -->
>
>       DECLARE
>    authString CLOB;
>   BEGIN
>    authString := PKG_ABC.FNC_SELECT_USER(#{userName, mode=IN,
> jdbcType=VARCHAR},
>       #{credentials, mode=IN, jdbcType=VARCHAR});
>   END;
>    </select>
> </mapper>
>
>
> AuthorizationMapper.java -
>
>
> public interface AuthorizationMapper
> {
>  Clob getAuthorizations(@Param("userName") String userName,
> @Param("credentials") String credentials);
> }
>
>
>
> AuthorizationServiceImpl.java -
>
> @Service("authorizationService")
> @Transactional("oraTransactionManager")
> public class AuthorizationServiceImpl implements AuthorizationService {
>
>  @Autowired
>  private AuthorizationMapper authorizationMapper;
>  public String getAuthorizations(String userName, String credentials) {
>
>   Clob clob = authorizationMapper.getAuthorizations(userName, credentials);
>   if(clob==null)
>    System.out.println("*********** Clob is empty");
>
>   String authorizationsList = getStringFromInputString(clob);
>
>
>   if(authorizationsList!=null)) {
>
>    System.out.println("authorizations is NOT NULL");
>
>    return authorizationsList;
>   }
>   else {
>    System.out.println("in ServiceImpl : authorizations is empty");
>    return null;
>   }
>
>  }
>
>  private String getStringFromInputString(Clob clob){
>
>         StringBuffer sb = null;
>         Reader rdr = null;
>         String authorizeStr = null;
>         try {
>             rdr = clob.getCharacterStream();
>             int size = (int) clob.length();
>             char buffer[] = new char[size];
>             int length;
>                 sb = new StringBuffer();
>             while ((length = rdr.read(buffer,0,size)) != -1 ) {
>                 sb.append( buffer, 0, length );
>             }
>             authorizeStr = sb.toString();
>  }catch(Exception e){
>   System.out.println("Error occurred :"+e.getMessage());
>
>   e.printStackTrace(System.out);
>  }
>         return authorizeStr;
>  }

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.



--
Rick R



--
Rick R



--
Rick R

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.