Exception in SEQUENCE V6.5

I’m getting the following exception after installing v 6.5.


com.haulmont.cuba.core.global.RemoteException:
---
javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.2.cuba15): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.microsoft.sqlserver.jdbc.SQLServerException: There is already an object named 'SEQ_UN_DELIVERYORDER' in the database.
Error Code: 2714
Call: create sequence SEQ_UN_DELIVERYORDER as bigint increment by 1 start with 1 minvalue 0
Query: DataModifyQuery(sql="create sequence SEQ_UN_DELIVERYORDER as bigint increment by 1 start with 1 minvalue 0")
---
org.eclipse.persistence.exceptions.DatabaseException: 
Internal Exception: com.microsoft.sqlserver.jdbc.SQLServerException: There is already an object named 'SEQ_UN_DELIVERYORDER' in the database.
Error Code: 2714
Call: create sequence SEQ_UN_DELIVERYORDER as bigint increment by 1 start with 1 minvalue 0
Query: DataModifyQuery(sql="create sequence SEQ_UN_DELIVERYORDER as bigint increment by 1 start with 1 minvalue 0")
---
com.microsoft.sqlserver.jdbc.SQLServerException: There is already an object named 'SEQ_UN_DELIVERYORDER' in the database.
	at com.haulmont.cuba.core.sys.ServiceInterceptor.aroundInvoke(ServiceInterceptor.java:127)
	at sun.reflect.GeneratedMethodAccessor152.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:629)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:618)
	at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
	at com.sun.proxy.$Proxy216.getNextNumber(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.haulmont.cuba.core.sys.remoting.LocalServiceInvokerImpl.invoke(LocalServiceInvokerImpl.java:94)
	at com.haulmont.cuba.web.sys.remoting.LocalServiceProxy$LocalServiceInvocationHandler.invoke(LocalServiceProxy.java:148)
	at com.sun.proxy.$Proxy34.getNextNumber(Unknown Source)
	at com.company.web.sd.deliveryorder.DeliveryOrderEdit.preCommit(DeliveryOrderEdit.java:113)
	

Is there anyone who has faced the same issue or have any idea what is wrong? Thanks in advance for your help.

I figured it out. But I don’t know if this is because of the 6.5 version or my change in the SQL server driver to > 2012. When I deleted the SEQ_UN table, it worked.

This is certainly caused by your switch to SQLServer 2012. On 2012, CUBA uses sequences for generating unique numbers and Integer/Long ID values. If your database has already been used as pre-2012, it may contain tables with autoincrement fields which were used for the same purpose and they have the same names.

You should drop these tables and set initial values to the sequences to the last values from those tables.

Thank you Konstantin. Where is the sequence saved?