ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From NathanM <nathan.mel...@infdig.com>
Subject Re: NVARCHAR not supported?
Date Tue, 19 May 2009 00:50:45 GMT

Then what am I doing wrong with my resolver type? 

Ibator keeps failing with the "Cannot instantiate object . . . .

Does this instantiation not use the classpath entries in the
ibatorConfig.xml file? I've tried putting an entry in there for the bin
directory which has class files, and I've tried putting the custom resolver
in a jar file and putting the jar file as a classpath entry. 

I have done a unit test and have no trouble loading this particular class. 


import java.sql.Types;
import java.util.List;
import java.util.Properties;

import org.apache.ibatis.ibator.api.IntrospectedColumn;
import org.apache.ibatis.ibator.api.JavaTypeResolver;
import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
import org.apache.ibatis.ibator.config.IbatorContext;
import org.apache.ibatis.ibator.internal.types.JavaTypeResolverDefaultImpl;

public class JavaTypeResolverWithNVarChar implements JavaTypeResolver {
	JavaTypeResolverDefaultImpl impl = new JavaTypeResolverDefaultImpl();
	public JavaTypeResolverWithNVarChar()

	/* (non-Javadoc)
	 * @see
	public void addConfigurationProperties(Properties properties) {

	/* (non-Javadoc)
	 * @see
	public void setIbatorContext(IbatorContext ibatorContext) {

	/* (non-Javadoc)
	 * @see
	public void setWarnings(List<String> warnings) {

	 * Override this method to add NVarChar to the list of supported types
	public FullyQualifiedJavaType calculateJavaType(IntrospectedColumn
        FullyQualifiedJavaType answer;
		if(introspectedColumn.getJdbcType() == Types.NVARCHAR)
			answer = new FullyQualifiedJavaType(String.class.getName());
			answer = impl.calculateJavaType(introspectedColumn);
		return answer;


Jeff Butler-2 wrote:
> As far as iBATIS goes, as long as the driver allows treating the
> NVARCHAR column as VARCHAR, it should work out of the box.  If the
> driver requires you to call the new JDBC 4.0 methods, then you'll have
> to write a custom type handler.
> Jeff Butler

So I take it the SqlServer driver doesn't allow treating NVarChars as
VARCHARS, or it would already work? I'm using the Microsoft sqljdbc4.jar

View this message in context: http://www.nabble.com/NVARCHAR-not-supported--tp23568890p23607788.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

View raw message