-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: custom sql create doesn't work for me
PostPosted: Tue Mar 07, 2006 10:06 am 
Newbie

Joined: Fri Jan 13, 2006 10:14 am
Posts: 4
Location: MD
Hibernate version: 3.0.5

Mapping documents:
IndexNavigare.hbm.xml
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
                            "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                            "hibernate-mapping-3.0.dtd" >

<hibernate-mapping package="data">
   <class name="IndexNavigare">
      <id name="indexId" type="long">
         <generator class="assigned"/>
      </id>
      
      <property name="entitateId" type="long" not-null="true" />
      <property name="lucrareId" type="long" not-null="false" />
      <property name="expresieId" type="long" not-null="false" />
      <property name="manifestareId" type="long" not-null="false" />
      <property name="exemplarId" type="long" not-null="false" />
      <property name="autoritateId" type="long" not-null="false" />
      <property name="valoareSortare" type="string" not-null="true" />
      <property name="valoareAfisare" type="string" not-null="true" />
      
      <sql-insert>INSERT INTO INDEX_NAVIGARE1(ENTITATE_ID, LUCRARE_ID, EXPRESIE_ID, MANIFESTARE_ID, EXEMPLAR_ID, AUTORITATE_ID, VALOARE_SORTARE, VALOARE_AFISARE, IDX_NAVIGARE_ID) VALUES(?,?,?,?,?,?,?,?,?)</sql-insert>
<!--      <sql-insert callable="true">{ call insertIndexNavigare (?, ?, ?, ?, ?, ?, ?, ?, ?) }</sql-insert> -->
      
    </class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
Code:
      IndexNavigare in = new IndexNavigare(new Long(1));
      in.setEntitateId(new Long(1));
      in.setLucrareId(new Long(1));
      in.setValoareAfisare("valoare afisare p/u lucrarea 1");
      in.setValoareSortare("valoare sortare p/u lucrarea 1");
      session.save(in);
      session.flush();


Name and version of the database you are using: Oracle 10.1.0.2

I found this interesting, because hibernate doesn't give any error but data in database doesn't appear.

This is what hibernate shows:
Code:
. . .
15:56:55,247  INFO SettingsFactory:228 - Optimize cache for minimal puts: disabled
15:56:55,248  INFO SettingsFactory:237 - Structured second-level cache entries: disabled
15:56:55,264  INFO SettingsFactory:261 - Statistics: disabled
15:56:55,266  INFO SettingsFactory:265 - Deleted entity synthetic identifier rollback: disabled
15:56:55,268  INFO SettingsFactory:279 - Default entity-mode: pojo
15:56:55,582  INFO SessionFactoryImpl:152 - building session factory
15:56:56,273  INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
15:56:56,275  INFO SessionFactoryImpl:379 - Checking 0 named queries
15:56:56,470 DEBUG SQL:324 - INSERT INTO INDEX_NAVIGARE1(ENTITATE_ID, LUCRARE_ID, EXPRESIE_ID, MANIFESTARE_ID, EXEMPLAR_ID, AUTORITATE_ID, VALOARE_SORTARE, VALOARE_AFISARE, IDX_NAVIGARE_ID) VALUES(?,?,?,?,?,?,?,?,?)
15:56:56,800 DEBUG LongType:59 - binding '1' to parameter: 1
15:56:56,802 DEBUG LongType:59 - binding '1' to parameter: 2
15:56:56,808 DEBUG LongType:52 - binding null to parameter: 3
15:56:56,809 DEBUG LongType:52 - binding null to parameter: 4
15:56:56,811 DEBUG LongType:52 - binding null to parameter: 5
15:56:56,812 DEBUG LongType:52 - binding null to parameter: 6
15:56:56,813 DEBUG StringType:59 - binding 'valoare sortare p/u lucrarea 1' to parameter: 7
15:56:56,815 DEBUG StringType:59 - binding 'valoare afisare p/u lucrarea 1' to parameter: 8
15:56:56,816 DEBUG LongType:59 - binding '1' to parameter: 9
15:56:56,999  INFO SessionFactoryImpl:776 - closing


Any information on this wold be very appreciated.


Top
 Profile  
 
 Post subject: use transaction
PostPosted: Tue Mar 07, 2006 10:33 am 
Newbie

Joined: Fri Jan 13, 2006 10:14 am
Posts: 4
Location: MD
I have found why it didn't work. I simply used a transaction and now all is ok. It works fine. Remains to check if stored procedure will do this work so well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.