Bug #59942 cluster/j - PK with varbinary/binary fails
Submitted: 4 Feb 2011 10:53 Modified: 31 Mar 2011 11:27
Reporter: Johan Andersson Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster/J Severity:S3 (Non-critical)
Version:7.1.9a OS:Any
Assigned to: Craig Russell CPU Architecture:Any

[4 Feb 2011 10:53] Johan Andersson
Description:
Feb 4, 2011 11:51:43 AM com.mysql.clusterj.core.SessionFactoryImpl getSessionFactory
INFO: SessionFactoryImpl creating new SessionFactory with key localhost:1186+test
Feb 4, 2011 11:51:43 AM com.mysql.clusterj.core.metadata.DomainTypeHandlerFactoryImpl <clinit>
INFO: Found 0 DomainTypeHandlerFactories
here
Feb 4, 2011 11:51:44 AM com.mysql.clusterj.tie.Utility addCollation
INFO: Adding charset converter latin1 for collation 5
Feb 4, 2011 11:51:44 AM com.mysql.clusterj.tie.Utility addCollation
INFO: Adding charset converter latin1 for collation 8
Feb 4, 2011 11:51:44 AM com.mysql.clusterj.tie.Utility addCollation
INFO: Adding charset converter latin1 for collation 15
Feb 4, 2011 11:51:44 AM com.mysql.clusterj.tie.Utility addCollation
INFO: Adding charset converter latin1 for collation 31
Feb 4, 2011 11:51:44 AM com.mysql.clusterj.tie.Utility addCollation
INFO: Adding charset converter latin1 for collation 47
Feb 4, 2011 11:51:44 AM com.mysql.clusterj.tie.Utility addCollation
INFO: Adding charset converter latin1 for collation 48
Feb 4, 2011 11:51:44 AM com.mysql.clusterj.tie.Utility addCollation
INFO: Adding charset converter latin1 for collation 49
Feb 4, 2011 11:51:44 AM com.mysql.clusterj.tie.Utility addCollation
INFO: Adding charset converter latin1 for collation 94
com.mysql.clusterj.ClusterJUserException: Trying standard factory com.mysql.clusterj.core.metadata.DomainTypeHandlerImpl.
java.lang.NullPointerException Caused by java.lang.NullPointerException:null
	at com.mysql.clusterj.core.metadata.DomainTypeHandlerFactoryImpl.createDomainTypeHandler(DomainTypeHandlerFactoryImpl.java:81)
	at com.mysql.clusterj.core.SessionFactoryImpl.getDomainTypeHandler(SessionFactoryImpl.java:219)
	at com.mysql.clusterj.core.SessionImpl.getDomainTypeHandler(SessionImpl.java:922)
	at com.mysql.clusterj.core.SessionImpl.newInstance(SessionImpl.java:246)
	at Main.main(Main.java:32)
Caused by: java.lang.NullPointerException
	at com.mysql.clusterj.core.metadata.AbstractDomainFieldHandlerImpl.validateIndexType(AbstractDomainFieldHandlerImpl.java:385)
	at com.mysql.clusterj.core.metadata.IndexHandlerImpl.setDomainFieldHandlerFor(IndexHandlerImpl.java:170)
	at com.mysql.clusterj.core.metadata.AbstractDomainTypeHandlerImpl.registerIndices(AbstractDomainTypeHandlerImpl.java:166)
	at com.mysql.clusterj.core.metadata.DomainFieldHandlerImpl.<init>(DomainFieldHandlerImpl.java:260)
	at com.mysql.clusterj.core.metadata.DomainTypeHandlerImpl.<init>(DomainTypeHandlerImpl.java:171)
	at com.mysql.clusterj.core.metadata.DomainTypeHandlerFactoryImpl.createDomainTypeHandler(DomainTypeHandlerFactoryImpl.java:77)
	... 4 more
java.lang.NullPointerException
	at com.mysql.clusterj.core.metadata.AbstractDomainFieldHandlerImpl.validateIndexType(AbstractDomainFieldHandlerImpl.java:385)
	at com.mysql.clusterj.core.metadata.IndexHandlerImpl.setDomainFieldHandlerFor(IndexHandlerImpl.java:170)
	at com.mysql.clusterj.core.metadata.AbstractDomainTypeHandlerImpl.registerIndices(AbstractDomainTypeHandlerImpl.java:166)
	at com.mysql.clusterj.core.metadata.DomainFieldHandlerImpl.<init>(DomainFieldHandlerImpl.java:260)
	at com.mysql.clusterj.core.metadata.DomainTypeHandlerImpl.<init>(DomainTypeHandlerImpl.java:171)
	at com.mysql.clusterj.core.metadata.DomainTypeHandlerFactoryImpl.createDomainTypeHandler(DomainTypeHandlerFactoryImpl.java:77)
	at com.mysql.clusterj.core.SessionFactoryImpl.getDomainTypeHandler(SessionFactoryImpl.java:219)
	at com.mysql.clusterj.core.SessionImpl.getDomainTypeHandler(SessionImpl.java:922)
	at com.mysql.clusterj.core.SessionImpl.newInstance(SessionImpl.java:246)
	at Main.main(Main.java:32)

How to repeat:
 create table t1(a varbinary(32) primary key, b varbinary(255))engine=ndb;

same Main.java is in previous bug

myT1.java  (modifed to read out byte[] from PK:

import com.mysql.clusterj.annotation.PersistenceCapable;
import com.mysql.clusterj.annotation.PrimaryKey;

@PersistenceCapable(table="t1")
public interface myT1 {
		@PrimaryKey
		byte[] getA();
		void setA(byte [] key);

		byte [] getB();
		void setB(byte [] data);

}
[6 Feb 2011 23:39] Craig Russell
revno: 4085
committer: Craig L Russell <Craig.Russell@oracle.com>
branch nick: mysql-5.1-telco-7.1
timestamp: Sun 2011-02-06 13:37:05 -0800
message:
  Add support for binary columns as key columns.
  Improve error reporting for unsupported column types.
  Fix bug in update handling for DynamicObject persistent classes.
  Add test cases for binary, varbinary, and longvarbinary primary key columns.
[31 Mar 2011 11:27] Jon Stephens
Documented fix in the NDB-7.1.12 changelog as follows:

        Binary columns can now be used as key columns.

        Error reporting when trying to use unsupported column types has
        been improved.

        Updates for DynamicObject persistent classes are now 
        handled as expected.

Closed.