I should add that we are using Hibernate Entity Manager version 3.6.0.Final
-----Original Message----- From: Gasper, John [mailto:[email protected]] Sent: Tuesday, January 31, 2012 10:30 AM To: [email protected] Subject: RE: [cas-user] Error saving service to sql server 2005 Aaron, I use SQL Server 2008 for my backend storage of tickets and services, and I use the standard dialect: database.hibernate.dialect=org.hibernate.dialect.SQLServerDialect The only noticeable difference between your config and mine is that I don't have the "selectMethod=cursor;" directive in the connection string like you do. Let me know if I can provide any other information for you. John -----Original Message----- From: Aaron Chantrill [mailto:[email protected]] Sent: Tuesday, January 31, 2012 7:18 AM To: [email protected] Subject: [cas-user] Error saving service to sql server 2005 I'm using CAS 3.3.1 and finally am finally getting around to trying to link my services to my SQL Server 2005 server. I changed this: <bean id="serviceRegistryDao" class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl" /> to this: <bean id="serviceRegistryDao" class="org.jasig.cas.services.JpaServiceRegistryDaoImpl" p:entityManagerFactory-ref="entityManagerFactory" /> This basically just makes my serviceRegistryDao use the same entityManagerFactory-ref as I have been successfully using to store tickets: <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory"/> </bean> Now when I attempt to add a service, /cas/services/add.html?id= is giving me a 500 error, and I'm getting the following error in my tomcat6-stdout.log file: 2012-01-31 08:54:15,710 DEBUG [org.jasig.cas.services.web.RegisteredServiceSimpleFormController] - <No errors -> processing submit> Hibernate: insert into RegisteredServiceImpl (allowedToProxy, anonymousAccess, description, enabled, evaluation_order, ignoreAttributes, name, serviceId, ssoEnabled, theme, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2012-01-31 08:54:15,773 ERROR [org.hibernate.util.JDBCExceptionReporter] - <The value is not set for the parameter number 11.> I see a thread from two years ago. The last suggestion was to confirm that the id was actually an identity column, which it is: CREATE TABLE [dbo].[RegisteredServiceImpl]( [id] [numeric](19, 0) IDENTITY(1,1) NOT NULL, [allowedToProxy] [tinyint] NOT NULL, [anonymousAccess] [tinyint] NOT NULL, [description] [varchar](255) NULL, [enabled] [tinyint] NOT NULL, [evaluation_order] [int] NOT NULL, [ignoreAttributes] [tinyint] NOT NULL, [name] [varchar](255) NULL, [serviceId] [varchar](255) NULL, [ssoEnabled] [tinyint] NOT NULL, [theme] [varchar](255) NULL, PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] So it looks like this is an issue where the insert should look like: insert into RegisteredServiceImpl (allowedToProxy, anonymousAccess, description, enabled, evaluation_order, ignoreAttributes, name, serviceId, ssoEnabled, theme) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) since Identity columns are populated automatically and will usually error if you even attempt to specify the value of that field. Seems like I must have the wrong Dialect set somewhere. In cas.properties I have: database.hibernate.dialect=org.hibernate.dialect.SQLServerDialect In DeployerConfigContext.xml I have: <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <property name="generateDdl" value="true"/> <property name="showSql" value="true" /> </bean> </property> <property name="jpaProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> </props> </property> </bean> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" p:driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" p:url="jdbc:sqlserver://TESTDB\CASEY;databaseName=INTRANET;selectMethod=cursor;" p:username="CasUser" p:password="<<casuser's password>>" /> I'm not sure where else to look. I appreciate any suggestions. Thanks, Aaron -- You are currently subscribed to [email protected] as: [email protected] To unsubscribe, change settings or access archives, see http://www.ja-sig.org/wiki/display/JSG/cas-user -- You are currently subscribed to [email protected] as: [email protected] To unsubscribe, change settings or access archives, see http://www.ja-sig.org/wiki/display/JSG/cas-user -- You are currently subscribed to [email protected] as: [email protected] To unsubscribe, change settings or access archives, see http://www.ja-sig.org/wiki/display/JSG/cas-user
