Insertion code looks like the following:
Code:
Session hibernate = null;
hibernate = getHBSession();
hibernate.saveOrUpdate(security);
hibernate.flush();
hibernate.connection().commit();
error log:
Code:
10:34:57,851 ERROR JDBCExceptionReporter:46 - [TSING-TAO]INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'securityId'. The conflict occurred in database 'Trading', table 'Security', column 'securityID'.
10:34:57,866 ERROR JDBCExceptionReporter:38 - could not insert collection: [com.saghill.domainmodel.security.BaseSecurity.tranches#2093692]
com.inet.tds.SQLException: Msg 547, Level 16, State 0, Line 1, Sqlstate 23000
[TSING-TAO]INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'securityId'. The conflict occurred in database 'Trading', table 'Security', column 'securityID'.
at com.inet.tds.a.a(Unknown Source)
at com.inet.tds.a.a(Unknown Source)
at com.inet.tds.c.int(Unknown Source)
at com.inet.tds.c.executeUpdate(Unknown Source)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:538)
at net.sf.hibernate.impl.ScheduledCollectionRecreate.execute(ScheduledCollectionRecreate.java:23)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2308)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2265)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2187)
at com.saghill.domainmodel.security.util.SHSecurityFactory.saveInternal(SHSecurityFactory.java:59)
SQL log:
Code:
RPC:Completed declare @P1 int
set @P1=1
exec sp_prepare @P1 output, N'@p1 nvarchar(4000),@p2 nvarchar(4000),@p3 nvarchar(4000),@p4 bit,@p5 bit,@p6 real,@p7 int,@p8 int,@p9 int,@p10 int,@p11 int', N'insert into trading..security (securityName, symbol, bbSymbol, active, settlesPhysically, priceFactor, currency, country, exchange, issuecompany, corporateentity, securityType) values (@p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, ''1'')'
select @P1
RPC:Completed exec sp_execute 1, N'APE Test Stock01-16-04 10:34:46:046', N'TESTSTK139678', NULL, 1, 0, 1.000000000000000e+001, 1, 1, 1, 0, 4117
RPC:Completed declare @P1 int
set @P1=2
exec sp_prepare @P1 output, N'', N'select @@identity'
select @P1
RPC:Completed exec sp_execute 2
RPC:Completed declare @P1 int
set @P1=3
exec sp_prepare @P1 output, N'@p1 int,@p2 int,@p3 nvarchar(4000),@p4 nvarchar(4000),@p5 nvarchar(4000),@p6 nvarchar(4000),@p7 nvarchar(4000)', N'insert into trading..tranche (security, tranche, bbid, common, cusip, isin, sedol) values (@p1, @p2, @p3, @p4, @p5, @p6, @p7)'
select @P1
RPC:Completed exec sp_execute 3, 2093692, 1, NULL, NULL, NULL, NULL, NULL
Please let me know if you need logging from specific hibernate packages.
Thanks!