tracker issue : CF-3043047

select a category, or use search below
(searches all categories and all time range)
Title:

Bug 85779:I have a table in Microsoft SQL Server 2008 where the primary key is a uniqueidentifier

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/

Reporter/Name(from Bugbase): Andrew Clarke / Andrew Clarke (AndrewNClarke)

Created: 01/11/2011

Components: ORM Support

Versions: 9.0.1

Failure Type: Unspecified

Found In Build/Fixed In Build: 9,0,1,274733 /

Priority/Frequency: Normal / Unknown

Locale/System: English / Win All

Vote Count: 0

Problem:

I have a table in Microsoft SQL Server 2008 where the primary key is a uniqueidentifier. I created an entity CFC that's blank, i.e. no properties defined.  I then instantiated a new entity, filled it in and tried to save it.  I got this error:ids for this class must be manually assigned before calling save(): ProductIf I create an identifier for productID, the table gets saved.  However, as SQL is supposed to generate this, I shouldn't have to create an identifier.  If I do an insert from Query Analyzer with no productID, the row gets inserted fine.
Method:

DDL to create the table:/****** Object:  Table [dbo].[Product]    Script Date: 01/11/2011 09:26:30 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOSET ANSI_PADDING ONGOCREATE TABLE [dbo].[Product]([ProductId] [uniqueidentifier] NOT NULL,[CategoryId] [uniqueidentifier] NOT NULL,[Title] [varchar](50) NOT NULL,[Description] [varchar](50) NOT NULL,[IsActive] [bit] NOT NULL,[CategoryOrder] [tinyint] NOT NULL,[InsertDate] [smalldatetime] NOT NULL,[LastUpdate] [smalldatetime] NOT NULL, CONSTRAINT [PK_Product] PRIMARY KEY CLUSTERED ([ProductId] ASC)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]) ON [PRIMARY]GOSET ANSI_PADDING OFFGOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'PK' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Product', @level2type=N'COLUMN',@level2name=N'ProductId'GOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'What Category is this Product in? Can be only one.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Product', @level2type=N'COLUMN',@level2name=N'CategoryId'GOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Product title.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Product', @level2type=N'COLUMN',@level2name=N'Title'GOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Unformatted copy of the product detail. USE CSS FOR DISPLAY.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Product', @level2type=N'COLUMN',@level2name=N'Description'GOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Is this product publicly viewable or not?' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Product', @level2type=N'COLUMN',@level2name=N'IsActive'GOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Set the order of the products in their respective categories. Respects CategoryId.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Product', @level2type=N'COLUMN',@level2name=N'CategoryOrder'GOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Date the record was inserted.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Product', @level2type=N'COLUMN',@level2name=N'InsertDate'GOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Date the record was last updated.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Product', @level2type=N'COLUMN',@level2name=N'LastUpdate'GOHere's an example SQL query that works:insert into Product (categoryID, lastUpdate, insertDate, title, isActive, description, categoryOrder)values ('DF9912F3-775A-46E7-8C90-ED1979F13C3B','2010-01-01','2011-01-11','My title',1,'Hello kitty description',4);Here's some ColdFusion code to reproduce the error:p = entityNew("Product");p.setLastUpdate("2011-01-01");p.setInsertDate("2011-01-11");p.setTitle("My title");p.setCategoryID("DF9912F3-775A-46E7-8C90-ED1979F13C3B");p.setIsActive(1);p.setDescription("My description");p.setCategoryOrder(5);// p.setProductID("3150BEF3-FEA5-4C0E-BE35-6313F0D69676"); // If you un-comment this, you'll be able to save your Product.entitySave(p);
Result:

ids for this class must be manually assigned before calling save(): Productorg.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): Product at org.hibernate.id.Assigned.generate(Assigned.java:53) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:122) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93) at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:677) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:669) at coldfusion.orm.hibernate.SessionWrapper.saveOrUpdate(SessionWrapper.java:428) at coldfusion.orm.hibernate.HibernatePersistenceManager.save(HibernatePersistenceManager.java:145) at coldfusion.orm.hibernate.HibernatePersistenceManager.save(HibernatePersistenceManager.java:127) at coldfusion.orm.ORMUtils.entitySave(ORMUtils.java:195) at coldfusion.runtime.CFPage.EntitySave(CFPage.java:7745) at cfindex2ecfm42489266.runPage(C:\inetpub\cfscaffold\index.cfm:147) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:231) at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:416) at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:360) at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at coldfusion.filter.PathFilter.invoke(PathFilter.java:94) at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70) at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:79) at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38) at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62) at coldfusion.CfmServlet.service(CfmServlet.java:200) at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89) at jrun.servlet.FilterChain.doFilter(FilterChain.java:86) at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42) at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46) at jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at jrun.servlet.FilterChain.service(FilterChain.java:101) at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106) at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286) at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543) at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203) at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320) at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428) at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266) at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3043047

External Customer Info:
External Company:  
External Customer Name: Andrew Clarke
External Customer Email: 01DF5CD4463F906F9920154A
External Test Config: 01/11/2011

Attachments:

Comments: