We're updating the issue view to help you get more done. 

SQLException with boolean type on SQL Server 2008

Description

SQLException Cannot specify a column width on data type int with boolean type on SQL Server 2008 database.

Model:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 public interface Achievement extends ReferencableEntity { String getName(); void setName(String name); String getCatchPhrase(); void setCatchPhrase(String catchPhrase); String getDescription(); void setDescription(String description); Category getCategory(); void setCategory(Category category); Difficulty getDifficulty(); void setDifficulty(Difficulty level); @Default("false") boolean isHidden(); void setHidden(boolean hidden); @Default("true") boolean isActive(); void setActive(boolean active); @ManyToMany(UserAchievement.class) UserWrapper[] getUsers(); }

SQL generated by ao for the object :

1 2 3 4 5 6 7 8 9 10 11 CREATE TABLE AO_7A05D7_ACHIEVEMENT ( CATCH_PHRASE VARCHAR(255), CATEGORY INTEGER, DESCRIPTION VARCHAR(255), DIFFICULTY INTEGER, HIDDEN INTEGER(1) DEFAULT 0, ID INTEGER IDENTITY(1,1) NOT NULL, NAME VARCHAR(255), "REF" VARCHAR(255) UNIQUE NOT NULL, PRIMARY KEY(ID) )

The problem seems to be with INTEGER(1)

Trace:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 Caused by: net.java.ao.sql.ActiveObjectSqlException: java.sql.SQLException: Column, parameter, or variable #5: Cannot sp ecify a column width on data type int. at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.migrate(EntityManagedActiveObjects.java:44) at com.atlassian.activeobjects.internal.AbstractActiveObjectsFactory.create(AbstractActiveObjectsFactory.java:52 ) at com.atlassian.activeobjects.internal.DelegatingActiveObjectsFactory.create(DelegatingActiveObjectsFactory.jav a:39) at com.atlassian.activeobjects.internal.RegistryBasedActiveObjectsProvider.get(RegistryBasedActiveObjectsProvide r.java:29) at com.atlassian.activeobjects.osgi.DelegatingActiveObjects.getDelegate(DelegatingActiveObjects.java:126) at com.atlassian.activeobjects.osgi.DelegatingActiveObjects.find(DelegatingActiveObjects.java:76) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58 ) at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor .java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.ja va:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInter ceptor.java:56) at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java: 39) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.ja va:59) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor .java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.ja va:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy898.find(Unknown Source) at com.madgnome.jira.plugins.jirachievements.data.services.impl.ReferencableDaoService.get(ReferencableDaoServic e.java:22) at com.madgnome.jira.plugins.jirachievements.data.services.impl.ReferencableDaoService.getOrCreate(ReferencableD aoService.java:34) at com.madgnome.jira.plugins.jirachievements.data.services.impl.ReferencableDaoService.getOrCreate(ReferencableD aoService.java:8) ... 53 more Caused by: java.sql.SQLException: Column, parameter, or variable #5: Cannot specify a column width on data type int. at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368) at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2816) at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2254) at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:631) at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:584) at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:546) at net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:723) at net.sourceforge.jtds.jdbc.JtdsStatement.executeUpdate(JtdsStatement.java:1163) at net.sourceforge.jtds.jdbc.JtdsStatement.executeUpdate(JtdsStatement.java:1116) at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:228) at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:228) at net.java.ao.schema.SchemaGenerator.executeUpdate(SchemaGenerator.java:70) at net.java.ao.schema.SchemaGenerator.migrate(SchemaGenerator.java:56) at net.java.ao.EntityManager.migrate(EntityManager.java:142) at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.migrate(EntityManagedActiveObjects.java:40) ... 82 more

Environment

SQL Server 2008

Testing Notes

None

Status

Assignee

Samuel Le Berrigaud

Reporter

Julien Hoarau

Labels

Add-on Type

None

Team

None

CC

None

Risk factor

None

QA Kickoff Status

None

QA Demo Status

None

Components

Fix versions

Affects versions

ao-plugin 0.9.6

Priority

Major