i have a problem with creating a parameterized query using a composite id as a parameter passed to the query
Code:
tx = sesija.beginTransaction();
id.setSifraFakultet(new Long(1));
id.setSifraOdsek(new Long(3));
id.setSifraUsmerenje(new Long(3));
q = sesija.createQuery("delete from Usmerenje where id =:id");
q.setParameter("id",id);
q.executeUpdate();
tx.commit();
the output is
Jul 20, 2005 1:52:16 AM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.0.1
Jul 20, 2005 1:52:16 AM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Jul 20, 2005 1:52:16 AM org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Jul 20, 2005 1:52:16 AM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Jul 20, 2005 1:52:16 AM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Jul 20, 2005 1:52:16 AM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Jul 20, 2005 1:52:16 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/Student.hbm.xml
Jul 20, 2005 1:52:16 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: model.Student -> Student
Jul 20, 2005 1:52:16 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/PolozenIspit.hbm.xml
Jul 20, 2005 1:52:16 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: model.PolozenIspit -> PolozenIspit
Jul 20, 2005 1:52:16 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/Ispit.hbm.xml
Jul 20, 2005 1:52:16 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: model.Ispit -> Ispit
Jul 20, 2005 1:52:16 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/Fakultet.hbm.xml
Jul 20, 2005 1:52:16 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: model.Fakultet -> Fakultet
Jul 20, 2005 1:52:16 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/Odsek.hbm.xml
Jul 20, 2005 1:52:16 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: model.Odsek -> Odsek
Jul 20, 2005 1:52:16 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/Usmerenje.hbm.xml
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: model.Usmerenje -> Usmerenje
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/Kabinet.hbm.xml
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: model.Kabinet -> Kabinet
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/Profesor.hbm.xml
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: model.Profesor -> Profesor
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing extends queue
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing collection mappings
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.HbmBinder bindCollectionSecondPass
INFO: Mapping collection: model.Student.polozeniIspiti -> PolozenIspit
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.HbmBinder bindCollectionSecondPass
INFO: Mapping collection: model.Fakultet.odseci -> Odsek
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing association property references
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
Jul 20, 2005 1:52:17 AM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.SQLServerDialect
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
Jul 20, 2005 1:52:17 AM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Jul 20, 2005 1:52:17 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Jul 20, 2005 1:52:17 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
Jul 20, 2005 1:52:17 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
Jul 20, 2005 1:52:17 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.microsoft.jdbc.sqlserver.SQLServerDriver at URL: jdbc:microsoft:sqlserver://localhost;DataBaseName=Proba;User=Boris;Password=Boris
Jul 20, 2005 1:52:17 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=Boris, password=****}
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): disabled
Jul 20, 2005 1:52:17 AM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
Jul 20, 2005 1:52:17 AM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.HashtableCacheProvider
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: enabled
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Echoing all SQL to stdout
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
Jul 20, 2005 1:52:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
Jul 20, 2005 1:52:17 AM org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Jul 20, 2005 1:52:18 AM org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
Jul 20, 2005 1:52:18 AM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.SQLServerDialect
Jul 20, 2005 1:52:18 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Jul 20, 2005 1:52:18 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
Jul 20, 2005 1:52:18 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
Jul 20, 2005 1:52:18 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.microsoft.jdbc.sqlserver.SQLServerDriver at URL: jdbc:microsoft:sqlserver://localhost;DataBaseName=Proba;User=Boris;Password=Boris
Jul 20, 2005 1:52:18 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=Boris, password=****}
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: Running hbm2ddl schema update
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: fetching database metadata
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: updating schema
Jul 20, 2005 1:52:18 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing extends queue
Jul 20, 2005 1:52:18 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing collection mappings
Jul 20, 2005 1:52:18 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing association property references
Jul 20, 2005 1:52:18 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: Proba.dbo.Fakultet
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [naziv, sifrafakultet, adresa]
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: []
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [pk_fakultet]
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: Proba.dbo.Ispit
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [naziv, sifraprofesor, jj,gg, sifraispit]
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: [fk_ispit_reference_profesor]
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [pk_ispit]
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: Proba.dbo.Kabinet
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [sifraprofesor, sifrakabinet]
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: [fk_kabinet_reference_profesor]
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [pk_kabinet]
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: Proba.dbo.Odsek
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [naziv, fakultet, sifrafakultet, sifraodsek]
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: [fk_odsek_reference_fakultet, fk4887244fbd72b7c]
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [pk_odsek]
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: Proba.dbo.PolozenIspit
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [ispit, brojindeksa, datum, sifra, ocena, student]
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: [fk6f698d30e1a26d3d, fk6f698d3021a9899e, fk6f698d3028aa6e91, fk_polozeni_polozili_student, fk_polozeni_polozeni_ispit]
Jul 20, 2005 1:52:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [pk_polozenispit]
Jul 20, 2005 1:52:19 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: Proba.dbo.Profesor
Jul 20, 2005 1:52:19 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [ime, sifraprofesor, sifrakabinet, prezime]
Jul 20, 2005 1:52:19 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: [fk_profesor_reference_kabinet, fkc81b5a0ad604fefc]
Jul 20, 2005 1:52:19 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [pk_profesor]
Jul 20, 2005 1:52:19 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: Proba.dbo.Student
Jul 20, 2005 1:52:19 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [brojindeksa, ime, sifrafakultet, sifraodsek, sifrausmerenje, prezime]
Jul 20, 2005 1:52:19 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: [fk_student_reference_usmerenj]
Jul 20, 2005 1:52:19 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [pk_student]
Jul 20, 2005 1:52:19 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: Proba.dbo.Usmerenje
Jul 20, 2005 1:52:19 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [naziv, sifrafakultet, sifraodsek, sifrausmerenje]
Jul 20, 2005 1:52:19 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: [fk_usmerenj_reference_odsek]
Jul 20, 2005 1:52:19 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [pk_usmerenje]
Jul 20, 2005 1:52:19 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
SEVERE: Unsuccessful: alter table Odsek add constraint FK4887244655CC37D foreign key (fakultet) references Fakultet
Jul 20, 2005 1:52:19 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
SEVERE: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Column 'Fakultet.sifraFakultet' is not the same data type as referencing column 'Odsek.fakultet' in foreign key 'FK4887244655CC37D'.
Jul 20, 2005 1:52:19 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: schema update complete
Jul 20, 2005 1:52:19 AM org.hibernate.connection.DriverManagerConnectionProvider close
INFO: cleaning up connection pool: jdbc:microsoft:sqlserver://localhost;DataBaseName=Proba;User=Boris;Password=Boris
Jul 20, 2005 1:52:19 AM org.hibernate.impl.SessionFactoryImpl checkNamedQueries
INFO: Checking 0 named queries
Hibernate: delete from Usmerenje where (sifraFakultet, sifraOdsek, sifraUsmerenje)=?
Jul 20, 2005 1:52:19 AM org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 170, SQLState: HY000
Jul 20, 2005 1:52:19 AM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Line 1: Incorrect syntax near ','.
org.hibernate.exception.GenericJDBCException: could not execute update query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:82)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.hql.ast.UpdateStatementExecutor.execute(UpdateStatementExecutor.java:76)
at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:297)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:818)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:89)
at model.Fakultet.main(Fakultet.java:68)
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Line 1: Incorrect syntax near ','.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
at org.hibernate.hql.ast.UpdateStatementExecutor.execute(UpdateStatementExecutor.java:67)
... 4 more
Jul 20, 2005 1:52:19 AM org.hibernate.util.JDBCExceptionReporter logWarnings
WARNING: SQL Warning: 0, SQLState:
Jul 20, 2005 1:52:19 AM org.hibernate.util.JDBCExceptionReporter logWarnings
WARNING: [Microsoft][SQLServer 2000 Driver for JDBC]Database changed to Proba
Jul 20, 2005 1:52:19 AM org.hibernate.util.JDBCExceptionReporter logWarnings
WARNING: SQL Warning: 0, SQLState:
Jul 20, 2005 1:52:19 AM org.hibernate.util.JDBCExceptionReporter logWarnings
WARNING: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Changed database context to 'Proba'.
Jul 20, 2005 1:52:19 AM org.hibernate.util.JDBCExceptionReporter logWarnings
WARNING: SQL Warning: 0, SQLState:
Jul 20, 2005 1:52:19 AM org.hibernate.util.JDBCExceptionReporter logWarnings
WARNING: [Microsoft][SQLServer 2000 Driver for JDBC]Language changed to us_english
Jul 20, 2005 1:52:19 AM org.hibernate.util.JDBCExceptionReporter logWarnings
WARNING: SQL Warning: 0, SQLState:
Jul 20, 2005 1:52:19 AM org.hibernate.util.JDBCExceptionReporter logWarnings
WARNING: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Changed language setting to us_english.
I have ommited the irrelevant code and the mapping is fine
What am I doing wrong?