2 Replies Latest reply on Sep 27, 2011 12:52 PM by Sean Jensen

    Display Clob content

    Sean Jensen Newbie

      I'm running jBoss5.1.0.GA, jboss-seam-2.2.1.Final against an Oracle database

      We ran seamgen against an oracle database that had a clob field defined in a table.  The generated pages all display what looks like the .toString() of the retrieved Clob


      I want to display the actual contents of the Clob as text.  When I annotate the column definition and change the return type I get nulls for every item.  How am I supposed to display the content when seamgen only displays the object?

      This is what seamgen left me with:

           @Column(name = "TEXT", nullable = false)
           public Clob getText() {
                return this.text;

      It always shows the toString() of the SerializableClob object.

      This is what I have currently which returns a null because the text string is null every time:

           @Column(name = "TEXT", nullable = false, columnDefinition="CLOB")
           public String getText() {
      //          return this.text;
                if(this.text == null){
                     return null;
                StringBuffer returnStringBuffer = new StringBuffer();
                String strng;
                try {
                     BufferedReader buffy = new BufferedReader(this.text.getCharacterStream());
                     while((strng = buffy.readLine()) != null){
                } catch (Exception e) {
                     return null;
                return returnStringBuffer.toString();

      All I want to do is display the contents in a table on the seamgen created pages.  Is this a flaw or a feature?  Why would you have the content come back as the object instead of the contents?  I guess I don't really care why this was done I just need a work around for my project.  Could someone point me in the right direction or post an example of how these types of object can be handled?