Guest User

Untitled

a guest
Oct 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. public interface EventObjectRepository extends CrudRepository<EventObject, Long> {
  2. @Query(value = "select tb.content from table0 tb where tb.id=:id", nativeQuery = true)
  3. List<String> find(@Param("id") Long id);
  4. }
  5.  
  6. [clob1: '{"identity":0,"original_text":"some text","rowid":2}', clob2: '{"identity":2,"original_text":"some text","rowid":3}', clob3: '{"identity":3,"original_text":"some text","rowid":4}', clob4: '{"identity":4,"product.name":"some name","original_text":"some text","commodity.name":"some name","rowid":5}']
  7.  
  8. results.get(1)
  9.  
  10. [ERROR] 2018-10-22 13:44:45.113 [http-nio-8090-exec-1] [dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.Cla
  11. ssCastException: com.sun.proxy.$Proxy164 cannot be cast to java.lang.String] with root cause
  12. java.lang.ClassCastException: com.sun.proxy.$Proxy164 cannot be cast to java.lang.String
  13.  
  14. @Column(columnDefinition="text")
  15. @Lob
  16. private String content;
  17.  
  18. public interface EventObjectRepository extends CrudRepository<EventObject, Long> {
  19. @Query(value = "select tb.content from table0 tb where tb.id=:id", nativeQuery = true)
  20. List<Clob> find(@Param("id") Long id);
  21. }
  22.  
  23. InputStream stream = results.get(1).getAsciiStream();
  24. StringWriter w = new StringWriter();
  25. IOUtils.copy(stream, w);
  26. String clobAsString = w.toString();
Add Comment
Please, Sign In to add comment