openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DonBrady <dbr...@pobox.com>
Subject RE: Trimming Strings from Database Query Results
Date Wed, 01 Nov 2006 01:10:16 GMT

Patrick,

 Thank you so very much!

 I should have been able to figure that out myself I know.  I was headed in
the right direction but too slowly.

 I have now also added an override for getChar:

package com.x;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.apache.commons.lang.StringUtils;
import org.apache.openjpa.jdbc.sql.DB2Dictionary;

public class ExtendedDB2Dictionary extends
		org.apache.openjpa.jdbc.sql.DB2Dictionary {

	@Override
	public String getString(ResultSet rs, int col) throws SQLException {
		String str = super.getString(rs, col);
		if (str != null)
			str = str.trim();
		return str;
	}

	@Override
	public char getChar(ResultSet rs, int col) throws SQLException {

		char c = super.getChar(rs, col);
		if (c == 0)
			c = ' ';
		// make more TopLink compatible
		return c;
	}

}

-- 
View this message in context: http://www.nabble.com/Trimming-Strings-from-Database-Query-Results-tf2532395.html#a7106383
Sent from the open-jpa-dev mailing list archive at Nabble.com.


Mime
View raw message