Hibernate + Oracle10g + Sequoia   insert fails
----------------------------------------------

         Key: SEQUOIA-844
         URL: https://forge.continuent.org/jira/browse/SEQUOIA-844
     Project: Sequoia
        Type: Bug
  Components: JDBC Driver, Core  
    Versions: Sequoia 2.10.2    
 Environment: Intel Pentium M 1.86Ghz
Kubuntu edgy
java 1.5
Oracle 10g on  windows XP


    Reporter: alfonso olias


The error araises when  I run a simple java application that inserts a new 
record through hibernate. Then it throws this exception

Exception in thread "main" org.hibernate.exception.GenericJDBCException: could 
not get next sequence value
        at 
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
        at 
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
        at 
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
        at 
org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:96)
        at 
org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:98)
        at 
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
        at 
org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
        at 
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
        at 
org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
        at 
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
        at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535)
        at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
        at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519)
        at com.indra.itecban.hibernatesample.Main.sampleWrite(Main.java:30)
        at com.indra.itecban.hibernatesample.Main.main(Main.java:18)
Caused by: org.continuent.sequoia.common.exceptions.driver.DriverSQLException: 
Message of cause: Query 3 is not in the list of currently scheduled queries
        at 
org.continuent.sequoia.driver.Connection.statementExecuteQuery(Connection.java:2848)
        at 
org.continuent.sequoia.driver.Statement.executeQuery(Statement.java:467)
        at 
org.continuent.sequoia.driver.PreparedStatement.executeQuery(PreparedStatement.java:163)
        at 
org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:75)
        ... 11 more
Caused by: 
org.continuent.sequoia.common.exceptions.driver.protocol.BackendDriverException:
 Query 3 is not in the list of currently scheduled queries

##############################################################################################
This is the hibernate class to table mapping file

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd";>
<!-- Generated Nov 6, 2006 5:54:51 PM by Hibernate Tools 3.2.0.beta8 -->
<hibernate-mapping>
    <class name="com.indra.itecban.hibernatesample.People" table="people" ><!-- 
 schema="prbgrid" -->
        <id name="id" type="java.lang.Long">
            <column name="id" precision="22" scale="0" />
            <generator class="native">
                        <param name="sequence">people_seq</param>
                </generator> 
        </id>
        <property name="firstName" type="java.lang.String">
            <column name="first_name" length="4000" not-null="true" />
        </property>
        <property name="secondName" type="java.lang.String">
            <column name="second_name" length="4000" not-null="true" />
        </property>
    </class>
</hibernate-mapping>
##############################################################################################

The controller gives this output

09:50:27,064 DEBUG virtualdatabase.VirtualDatabaseWorkerThread.ITECBAN_DB Login 
accepted for itecban from /172.22.61.5
09:50:29,429 DEBUG virtualdatabase.VirtualDatabaseWorkerThread.ITECBAN_DB Login 
accepted for itecban from /172.22.61.5
09:50:29,579 DEBUG virtualdatabase.VirtualDatabaseWorkerThread.ITECBAN_DB Begin 
command
09:50:29,584 DEBUG virtualdatabase.VirtualDatabaseWorkerThread.ITECBAN_DB 
StatementExecuteQuery command
09:50:29,588 WARN  controller.virtualdatabase.ITECBAN_DB Request select 
people_seq.nextval from dual/ failed, transaction has been aborted (Query 3 is 
not in the list of currently scheduled queries)
09:50:29,589 WARN  virtualdatabase.VirtualDatabaseWorkerThread.ITECBAN_DB Error 
during command execution (Query 3 is not in the list of currently scheduled 
queries)
09:50:29,671 WARN  virtualdatabase.VirtualDatabaseWorkerThread.ITECBAN_DB 
Client (login:itecban,host:aolias.indra.es closed connection with server)
09:51:29,678 DEBUG virtualdatabase.VirtualDatabaseWorkerThread.ITECBAN_DB 
VirtualDatabaseWorkerThread associated to login: itecban terminating.
09:51:29,679 DEBUG virtualdatabase.VirtualDatabaseWorkerThread.ITECBAN_DB 
VirtualDatabaseWorkerThread associated to login: itecban terminating.
##############################################################################################

The virtual database configuration file is the following
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE SEQUOIA PUBLIC "-//Continuent//DTD SEQUOIA 2.10.2//EN" 
"http://sequoia.continuent.org/dtds/sequoia-2.10.2.dtd";>

<SEQUOIA>       
        <VirtualDatabase name="ITECBAN_DB">     
                <Monitoring>
                        <SQLMonitoring defaultMonitoring="off">
                                <SQLMonitoringRule queryPattern="^select" 
                                                   caseSensitive="true" 
                                                   applyToSkeleton ="false" 
                                                   monitoring="on"/>
                        </SQLMonitoring>
                </Monitoring>
                <AuthenticationManager>
                        <!-- Administrador para la consola de adminsitracion -->
                        <Admin>
                                <User username="admin" 
                                      password="admin"/>
                        </Admin>
                        <!-- Usuario virtual que usa nuestra aplicacion cliente 
para acceder a la bbdd
                             virtual-->
                        <VirtualUsers>
                                <VirtualLogin vLogin="itecban" 
                                              vPassword="itecban"/>
                        </VirtualUsers>
                </AuthenticationManager>
                
                <DatabaseBackend name="amdelcura.indra.es" 
                                 driver="oracle.jdbc.driver.OracleDriver"
                                 
url="jdbc:oracle:thin:@amdelcura.indra.es:1521:itecban" 
                                 connectionTestStatement="select * from dual">
                        <ConnectionManager vLogin="itecban" 
                                           rLogin="prbgrid" 
                                           rPassword="gridgrid">
                                <VariablePoolConnectionManager 
initPoolSize="40"/>
                        </ConnectionManager>
                        <DatabaseSchema gatherSystemTables="false"/>
                </DatabaseBackend>
                
                <RequestManager caseSensitiveParsing="false">                   
                        <RequestScheduler>
                                <SingleDBScheduler level="passThrough"/>
                        </RequestScheduler>
                        <RequestCache>
                                <MetadataCache/>
                                <ParsingCache/>
                                <ResultCache granularity="table">
                                        <DefaultResultCacheRule>
                                                <RelaxedCaching timeout="10" 
keepIfNotDirty="false"/>
                                        </DefaultResultCacheRule>
                                </ResultCache>
                        </RequestCache>
                        <LoadBalancer>
                                <SingleDB/>
                        </LoadBalancer>
                </RequestManager>
        </VirtualDatabase>
</SEQUOIA>

#############################################################################################
I have tested the console aplication 
and I can insert and select, But some times I get some weird errors

[EMAIL PROTECTED]:/usr/sequoia-2.10.1$ sudo ./bin/console.sh
Password:
Launching the Sequoia controller console
Initializing Controller module...
Initializing VirtualDatabase Administration module...
Initializing SQL Console module...
Sequoia driver (Sequoia core v2.10.2) successfully loaded.
localhost:1090 > sql client jdbc:sequoia://aolias.indra.es/ITECBAN_DB
Login > itecban
Password >
jdbc:sequoia://aolias.indra.es/ITECBAN_DB (itecban) > select * from people
An error occured while executing SQL query 
(org.continuent.sequoia.common.exceptions.driver.DriverSQLException: Message of 
cause: Query 14 is not in the list of currently scheduled queries)
jdbc:sequoia://aolias.indra.es/ITECBAN_DB (itecban) > select * from people

+------------------------+---------------------------+---------------------------+
| ID                     | FIRST_NAME                | SECOND_NAME              
 |
+------------------------+---------------------------+---------------------------+
| 19                     | Carmelo                   | Coton                    
 |
| 34                     | Felipe                    | Lotas                    
 |
| 35                     | Felipe                    | Lotas                    
 |
| 36                     | Felipe                    | Lotas                    
 |
| 37                     | Felipe                    | Lotas                    
 |
| 38                     | Felipe                    | Lotas                    
 |
| 6                      | Roger                     | Whitney                  
 |
| 7                      | Roger                     | Whitney                  
 |
| 8                      | Carmelo                   | Coton                    
 |
| 9                      | Manolito                  | Gafotas                  
 |
| 10                     | Manolito                  | Gafotas                  
 |
| 11                     | Manolito                  | Gafotas                  
 |
| 12                     | Manolito                  | Gafotas                  
 |
| 41                     | KArlos                    | ElgrenasFas              
 |
| 44                     | KArlos                    | ElgrenasFas              
 |
| 45                     | KArlos                    | ElgrenasFas              
 |
| 46                     | KArlos                    | ElgrenasFas              
 |
| 47                     | KArlos                    | ElgrenasFas              
 |
| 48                     | KArlos                    | ElgrenasFas              
 |
| 49                     | KArlos                    | ElgrenasFas              
 |
| 50                     | KArlos                    | ElgrenasFas              
 |
| 51                     | KArlos                    | ElgrenasFas              
 |
| 52                     | KArlos                    | ElgrenasFas              
 |
| 53                     | KArlos                    | ElgrenasFas              
 |
+------------------------+---------------------------+---------------------------+
Query executed in 0 s 73 ms .
jdbc:sequoia://aolias.indra.es/ITECBAN_DB (itecban) >                           
                 

jdbc:sequoia://aolias.indra.es/ITECBAN_DB (itecban) > insert into people 
(first_name, second_name, id) values ('KArlos', 'ElgrenasFas', 
people_seq.nextval)
An error occured while executing SQL query 
(org.continuent.sequoia.common.exceptions.driver.DriverSQLException: Message of 
cause: Query 16 is not in the list of currently scheduled queries)
jdbc:sequoia://aolias.indra.es/ITECBAN_DB (itecban) > insert into people 
(first_name, second_name, id) values ('KArlos', 'ElgrenasFas', 
people_seq.nextval)
Affected rows: 1
Query executed in 0 s 8 ms .
jdbc:sequoia://aolias.indra.es/ITECBAN_DB (itecban) >      

I do not know why it happends that the first time I launch the query it fails!?

I would appreciate any help
Thanks 
Alfonso


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   https://forge.continuent.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


_______________________________________________
Sequoia mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/sequoia

Reply via email to