-->
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.  [ 8 posts ] 
Author Message
 Post subject: postgres batch update or column mismatch ?
PostPosted: Thu Feb 26, 2004 4:33 am 
Beginner
Beginner

Joined: Thu Feb 19, 2004 6:07 am
Posts: 21
Hi all,
I am trying to insert an object into a postgres db using session.save(), but I find that I get errors - here is the complete log.
Something about jdbc batch updates - i have jdbc.batch_size set to 0.
And the latest postgres driver pg74.1jdbc3.jar
And something about null not being able to be inserted into non null
column replyid - but in the constructor for the object I did specify
replyid as 1. So what gives ?....um.....
Code:
15:16:01,234  INFO Environment:432 - Hibernate 2.1.1
15:16:01,250  INFO Environment:466 - loaded properties from resource hibernate.properties: {hibernate.connection.username=sanjeev, hibernate.connection.password=, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.sf.hibernate.dialect.PostgreSQLDialect, hibernate.connection.url=jdbc:postgresql:frmdb, jdbc.batch_size=0, hibernate.connection.driver_class=org.postgresql.Driver, hibernate.query.substitutions=yes 'Y', no 'N'}
15:16:01,265  INFO Environment:481 - using CGLIB reflection optimizer
15:16:01,265  INFO Configuration:318 - Mapping resource: Forum.hbm.xml
15:16:02,093  INFO Binder:225 - Mapping class: Forum -> forum
15:16:02,234  INFO Configuration:318 - Mapping resource: Post.hbm.xml
15:16:02,281  INFO Binder:225 - Mapping class: Post -> post
15:16:02,296  INFO Configuration:318 - Mapping resource: Poster.hbm.xml
15:16:02,343  INFO Binder:225 - Mapping class: Poster -> poster
15:16:02,343  INFO Configuration:584 - processing one-to-many association mappings
15:16:02,343  INFO Configuration:593 - processing one-to-one association property references
15:16:02,343  INFO Configuration:618 - processing foreign key constraints
15:16:02,390  INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.PostgreSQLDialect
15:16:02,390  INFO SettingsFactory:62 - Use outer join fetching: true
15:16:02,390  INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
15:16:02,390  INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 20
15:16:02,406  INFO DriverManagerConnectionProvider:71 - using driver: org.postgresql.Driver at URL: jdbc:postgresql:frmdb
15:16:02,421  INFO DriverManagerConnectionProvider:72 - connection properties: {user=sanjeev, password=}
15:16:02,421  INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
15:16:02,953  INFO SettingsFactory:89 - Use scrollable result sets: true
15:16:02,953  INFO SettingsFactory:90 - JDBC 2 max batch size: 15
15:16:02,953  INFO SettingsFactory:99 - Query language substitutions: {no='N', yes='Y'}
15:16:02,953  INFO SettingsFactory:110 - cache provider: net.sf.ehcache.hibernate.Provider
15:16:02,968  INFO Configuration:1057 - instantiating and configuring caches
15:16:03,250  INFO SessionFactoryImpl:119 - building session factory
15:16:03,687  INFO SessionFactoryObjectFactory:82 - no JNDI name configured
15:16:03,843  WARN JDBCExceptionReporter:38 - SQL Error: 0, SQLState: null
15:16:03,843 ERROR JDBCExceptionReporter:46 - Batch entry 0 [Ljava.lang.Object;@156b386 was aborted.
15:16:03,859  WARN JDBCExceptionReporter:38 - SQL Error: 0, SQLState: null
15:16:03,859 ERROR JDBCExceptionReporter:46 - ERROR:  ExecAppend: Fail to add null value in not null attribute threadid

15:16:03,859  WARN JDBCExceptionReporter:38 - SQL Error: 0, SQLState: null
15:16:03,859 ERROR JDBCExceptionReporter:46 - Batch entry 0 [Ljava.lang.Object;@156b386 was aborted.
15:16:03,859  WARN JDBCExceptionReporter:38 - SQL Error: 0, SQLState: null
15:16:03,859 ERROR JDBCExceptionReporter:46 - ERROR:  ExecAppend: Fail to add null value in not null attribute threadid

15:16:03,875 ERROR JDBCExceptionReporter:38 - Could not execute JDBC batch update
Batch entry 0 [Ljava.lang.Object;@156b386 was aborted.
   at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:105)
   at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
   at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:118)
   at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2311)
   at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2261)
   at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2187)
   at QueryEngine.runprog(QueryEngine.java:140)
   at QueryEngine.<init>(QueryEngine.java:39)
   at Myfe.actionPerformed(Myfe.java:111)
   at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
   at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
   at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
   at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
   at java.awt.Component.processMouseEvent(Component.java:5099)
   at java.awt.Component.processEvent(Component.java:4896)
   at java.awt.Container.processEvent(Container.java:1569)
   at java.awt.Component.dispatchEventImpl(Component.java:3614)
   at java.awt.Container.dispatchEventImpl(Container.java:1627)
   at java.awt.Component.dispatchEvent(Component.java:3476)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
   at java.awt.Container.dispatchEventImpl(Container.java:1613)
   at java.awt.Window.dispatchEventImpl(Window.java:1606)
   at java.awt.Component.dispatchEvent(Component.java:3476)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
15:16:03,890 ERROR SessionImpl:2269 - Could not synchronize database state with session
net.sf.hibernate.JDBCException: Could not execute JDBC batch update
   at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:125)
   at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2311)
   at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2261)
   at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2187)
   at QueryEngine.runprog(QueryEngine.java:140)
   at QueryEngine.<init>(QueryEngine.java:39)
   at Myfe.actionPerformed(Myfe.java:111)
   at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
   at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
   at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
   at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
   at java.awt.Component.processMouseEvent(Component.java:5099)
   at java.awt.Component.processEvent(Component.java:4896)
   at java.awt.Container.processEvent(Container.java:1569)
   at java.awt.Component.dispatchEventImpl(Component.java:3614)
   at java.awt.Container.dispatchEventImpl(Container.java:1627)
   at java.awt.Component.dispatchEvent(Component.java:3476)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
   at java.awt.Container.dispatchEventImpl(Container.java:1613)
   at java.awt.Window.dispatchEventImpl(Window.java:1606)
   at java.awt.Component.dispatchEvent(Component.java:3476)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Caused by: Batch entry 0 [Ljava.lang.Object;@156b386 was aborted.
   at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:105)
   at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
   at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:118)
   ... 29 more

___________________________________________________________
and this is my code from my main routine class.


Code:
Post thispost=new Post(1,1,1,new String("GUI: AWT vs Swing"),new String("Somebody told me that my interface looked hoakie and asked if Java can have GUIs that are as appealing as his VB interfaces. I just put basic swing components on my interface: buttons, text boxes, labels, etc...I didn't spend a whole lot of time figuring out how to change object attributes to possibly enhance my interface. As far as I understand swing is newer and better than AWT. Is this correct. Or do AWT interfaces look better? Can anybody direct me in this area and suggest the best way to get nice looking interfaces done with Java? Is this a drawback of Java?"),new Timestamp(System.currentTimeMillis()),1,1);
         session.save(thispost);
         System.out.println("Post saved:" + thispost.getPosttopic());
         session.flush();
         session.connection().commit();


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 26, 2004 8:25 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
mapping

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 26, 2004 11:11 pm 
Beginner
Beginner

Joined: Thu Feb 19, 2004 6:07 am
Posts: 21
Thanks for taking a look and here is the mapping.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping
    PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
   
<hibernate-mapping>

    <class name="Forum" table="forum">

        <!-- A 32 hex character is our surrogate key. It's automatically
            generated by Hibernate with the UUID pattern. -->
        <id name="forum_id" type="int" unsaved-value="null" >
            <column name="forum_id" sql-type="int" not-null="true"/>
            <generator class="native"/>
        </id>

        <property name="name">
            <column name="name" sql-type="char(255)" not-null="true"/>
        </property>
               
    </class>
   


</hibernate-mapping>   
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping
    PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
   
<hibernate-mapping>
    <class name="Poster" table="poster">
        <id name="poster_id" type="int" unsaved-value="null" >
            <column name="poster_id" sql-type="int"
                    not-null="true"/>
            <generator class="native"/>
        </id>
        <property name="name">
            <column name="name" sql-type="char(255)" not-null="true"/>
        </property>
        <property name="usernm">
            <column name="usernm" sql-type="char(10)" not-null="true"/>
        </property>
        <property name="joindt">
            <column name="joindt" sql-type="datetime" not-null="true"/>
        </property>
       
        </class>
</hibernate-mapping>
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping
    PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
   
<hibernate-mapping>

    <class name="Post" table="post">

        <!-- A 32 hex character is our surrogate key. It's automatically
            generated by Hibernate with the UUID pattern. -->
        <id name="id" type="int" unsaved-value="null" >
            <column name="id" sql-type="int" not-null="true"/>
            <generator class="native"/>
        </id>
        <property name="replyid" insert="false" update="false">
            <column name="replyid" sql-type="int" not-null="true"/>
        </property>
         <property name="threadid">
            <column name="replyid" sql-type="int" not-null="true"/>
        </property>
        <property name="posttopic" insert="false" update="false">
            <column name="posttopic" sql-type="text" not-null="true"/>
        </property>

        <property name="posttext" insert="false" update="false">
            <column name="posttext" sql-type="text" not-null="true"/>
        </property>
       
      <property name="timestmp">
            <column name="timestmp" sql-type="datetime" not-null="true"/>
        </property>
        <property name="f_id" insert="false" update="false">
            <column name="f_id" sql-type="int" not-null="true" />
        </property>
        <property name="p_id" insert="false" update="false">
            <column name="p_id" sql-type="int" not-null="true" />
        </property>
      <many-to-one name="forum" class="Forum" column="f_id" />
      <many-to-one name="poster" class="Poster" column="p_id"/>
       
    </class>

</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 12:12 am 
Beginner
Beginner

Joined: Thu Feb 19, 2004 6:07 am
Posts: 21
oops - just noticed a typo in POst.hbm.xml - the property line
with threadid and replyid is mismatched.
Corrected that - and still unable to insert using session.save().
Says not null attribute threadid cannot be null.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 12:52 am 
Beginner
Beginner

Joined: Thu Feb 19, 2004 6:07 am
Posts: 21
Sometimes I get this - :-(



Code:
11:48:21,015  INFO Environment:432 - Hibernate 2.1.1
11:48:21,031  INFO Environment:466 - loaded properties from resource hibernate.properties: {hibernate.connection.username=sanjeev, hibernate.connection.password=, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.sf.hibernate.dialect.PostgreSQLDialect, hibernate.connection.url=jdbc:postgresql:frmdb, hibernate.jdbc.batch_size=0, hibernate.connection.driver_class=org.postgresql.Driver, hibernate.query.substitutions=yes 'Y', no 'N'}
11:48:21,046  INFO Environment:481 - using CGLIB reflection optimizer
11:48:21,046  INFO Configuration:318 - Mapping resource: Forum.hbm.xml
11:48:21,625 DEBUG DTDEntityResolver:20 - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath under net/sf/hibernate/
11:48:21,625 DEBUG DTDEntityResolver:29 - found http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath
11:48:21,859  INFO Binder:225 - Mapping class: Forum -> forum
11:48:21,953 DEBUG Binder:449 - Mapped property: forum_id -> forum_id, type: integer
11:48:21,984 DEBUG Binder:449 - Mapped property: name -> name, type: string
11:48:21,984  INFO Configuration:318 - Mapping resource: Post.hbm.xml
11:48:22,000 DEBUG DTDEntityResolver:20 - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath under net/sf/hibernate/
11:48:22,000 DEBUG DTDEntityResolver:29 - found http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath
11:48:22,031  INFO Binder:225 - Mapping class: Post -> post
11:48:22,031 DEBUG Binder:449 - Mapped property: id -> id, type: integer
11:48:22,046 DEBUG Binder:449 - Mapped property: threadid -> threadid, type: integer
11:48:22,046 DEBUG Binder:449 - Mapped property: replyid -> replyid, type: integer
11:48:22,046 DEBUG Binder:449 - Mapped property: posttopic -> posttopic, type: string
11:48:22,046 DEBUG Binder:449 - Mapped property: posttext -> posttext, type: string
11:48:22,046 DEBUG Binder:449 - Mapped property: timestmp -> timestmp, type: timestamp
11:48:22,062 DEBUG Binder:449 - Mapped property: f_id -> f_id, type: integer
11:48:22,062 DEBUG Binder:449 - Mapped property: p_id -> p_id, type: integer
11:48:22,062 DEBUG Binder:449 - Mapped property: forum -> f_id, type: Forum
11:48:22,062 DEBUG Binder:449 - Mapped property: poster -> p_id, type: Poster
11:48:22,062  INFO Configuration:318 - Mapping resource: Poster.hbm.xml
11:48:22,078 DEBUG DTDEntityResolver:20 - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath under net/sf/hibernate/
11:48:22,078 DEBUG DTDEntityResolver:29 - found http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath
11:48:22,109  INFO Binder:225 - Mapping class: Poster -> poster
11:48:22,109 DEBUG Binder:449 - Mapped property: poster_id -> poster_id, type: integer
11:48:22,125 DEBUG Binder:449 - Mapped property: name -> name, type: string
11:48:22,125 DEBUG Binder:449 - Mapped property: usernm -> usernm, type: string
11:48:22,125 DEBUG Binder:449 - Mapped property: joindt -> joindt, type: timestamp
11:48:22,125  INFO Configuration:584 - processing one-to-many association mappings
11:48:22,125  INFO Configuration:593 - processing one-to-one association property references
11:48:22,140  INFO Configuration:618 - processing foreign key constraints
11:48:22,140 DEBUG Configuration:628 - resolving reference to class: Forum
11:48:22,140 DEBUG Configuration:628 - resolving reference to class: Poster
11:48:22,187  INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.PostgreSQLDialect
11:48:22,187  INFO SettingsFactory:62 - Use outer join fetching: true
11:48:22,187  INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
11:48:22,187  INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 20
11:48:22,203  INFO DriverManagerConnectionProvider:71 - using driver: org.postgresql.Driver at URL: jdbc:postgresql:frmdb
11:48:22,218  INFO DriverManagerConnectionProvider:72 - connection properties: {user=sanjeev, password=}
11:48:22,218  INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
11:48:22,218 DEBUG DriverManagerConnectionProvider:78 - total checked-out connections: 0
11:48:22,218 DEBUG DriverManagerConnectionProvider:94 - opening new JDBC connection
11:48:22,421 DEBUG DriverManagerConnectionProvider:100 - created connection to: jdbc:postgresql:frmdb, Isolation Level: 2
11:48:22,453 DEBUG DriverManagerConnectionProvider:114 - returning connection to pool, pool size: 1
11:48:22,453  INFO SettingsFactory:89 - Use scrollable result sets: true
11:48:22,453  INFO SettingsFactory:99 - Query language substitutions: {no='N', yes='Y'}
11:48:22,453  INFO SettingsFactory:110 - cache provider: net.sf.ehcache.hibernate.Provider
11:48:22,453  INFO Configuration:1057 - instantiating and configuring caches
11:48:22,750  INFO SessionFactoryImpl:119 - building session factory
11:48:22,750 DEBUG SessionFactoryImpl:125 - instantiating session factory with properties: {java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, hibernate.connection.password=, sun.boot.library.path=D:\j2sdk1.4.2\jre\bin, java.vm.version=1.4.2-beta-b19, hibernate.connection.username=sanjeev, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=US, sun.os.patch.level=Service Pack 1, java.vm.specification.name=Java Virtual Machine Specification, user.dir=D:\dasgupta\forumproj, java.runtime.version=1.4.2-beta-b19, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=D:\j2sdk1.4.2\jre\lib\endorsed, os.arch=x86, java.io.tmpdir=D:\DOCUME~1\sanjeev\LOCALS~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows XP, sun.java2d.fontpath=, log4j.configuration=log4j-to-file.properties, java.library.path=D:\j2sdk1.4.2\jre\bin;.;D:\WINDOWS\System32;D:\WINDOWS;d:\apache-ant-1.6.0\bin\;d:\j2sdk1.4.2\bin;d:\apache-ant-1.6.0\bin\;d:\j2sdk1.4.2\bin;d:\apache-ant-1.6.0\bin\;d:\j2sdk1.4.2\bin;D:\WINDOWS\System32;d:\postgres\bin;;d:\postgres\bin;;d:\postgres\bin;, java.specification.name=Java Platform API Specification, java.class.version=48.0, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, os.version=5.1, user.home=D:\Documents and Settings\sanjeev, user.timezone=Asia/Bangkok, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.4, hibernate.connection.driver_class=org.postgresql.Driver, java.class.path=D:\dasgupta\forumproj\lib;D:\dasgupta\forumproj\bin;D:\dasgupta\forumproj\lib\hibernate2.jar;D:\dasgupta\forumproj\lib\ant.jar;D:\dasgupta\forumproj\lib\c3p0.jar;D:\dasgupta\forumproj\lib\cglib2.jar;D:\dasgupta\forumproj\lib\commons-collections.jar;D:\dasgupta\forumproj\lib\commons-dbcp.jar;D:\dasgupta\forumproj\lib\commons-lang.jar;D:\dasgupta\forumproj\lib\commons-logging.jar;D:\dasgupta\forumproj\lib\commons-pool.jar;D:\dasgupta\forumproj\lib\concurrent.jar;D:\dasgupta\forumproj\lib\connector.jar;D:\dasgupta\forumproj\lib\dom4j.jar;D:\dasgupta\forumproj\lib\ehcache.jar;D:\dasgupta\forumproj\lib\jaas.jar;D:\dasgupta\forumproj\lib\jboss-cache.jar;D:\dasgupta\forumproj\lib\jboss-common.jar;D:\dasgupta\forumproj\lib\jboss-jmx.jar;D:\dasgupta\forumproj\lib\jboss-system.jar;D:\dasgupta\forumproj\lib\jcs.jar;D:\dasgupta\forumproj\lib\jdbc2_0-stdext.jar;D:\dasgupta\forumproj\lib\jgroups.jar;D:\dasgupta\forumproj\lib\jta.jar;D:\dasgupta\forumproj\lib\junit.jar;D:\dasgupta\forumproj\lib\kunststoff.jar;D:\dasgupta\forumproj\lib\log4j.jar;D:\dasgupta\forumproj\lib\odmg.jar;D:\dasgupta\forumproj\lib\optional.jar;D:\dasgupta\forumproj\lib\oscache.jar;D:\dasgupta\forumproj\lib\pg73jdbc2ee.jar;D:\dasgupta\forumproj\lib\pg74.1jdbc3.jar;D:\dasgupta\forumproj\lib\proxool.jar;D:\dasgupta\forumproj\lib\swarmcache.jar;D:\dasgupta\forumproj\lib\xalan.jar;D:\dasgupta\forumproj\lib\xerces.jar;D:\dasgupta\forumproj\lib\xml-apis.jar, user.name=sanjeev, hibernate.query.substitutions=yes 'Y', no 'N', java.vm.specification.version=1.0, java.home=D:\j2sdk1.4.2\jre, sun.arch.data.model=32, hibernate.dialect=net.sf.hibernate.dialect.PostgreSQLDialect, hibernate.connection.url=jdbc:postgresql:frmdb, user.language=en, java.specification.vendor=Sun Microsystems Inc., awt.toolkit=sun.awt.windows.WToolkit, hibernate.cglib.use_reflection_optimizer=true, java.vm.info=mixed mode, java.version=1.4.2-beta, java.ext.dirs=D:\j2sdk1.4.2\jre\lib\ext, sun.boot.class.path=D:\j2sdk1.4.2\jre\lib\rt.jar;D:\j2sdk1.4.2\jre\lib\i18n.jar;D:\j2sdk1.4.2\jre\lib\sunrsasign.jar;D:\j2sdk1.4.2\jre\lib\jsse.jar;D:\j2sdk1.4.2\jre\lib\jce.jar;D:\j2sdk1.4.2\jre\lib\charsets.jar;D:\j2sdk1.4.2\jre\classes, java.vendor=Sun Microsystems Inc., hibernate.jdbc.batch_size=0, file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.cpu.isalist=pentium i486 i386}
11:48:22,953  INFO ReflectHelper:160 - reflection optimizer disabled for: Post, NullPointerException: null
11:48:23,171 DEBUG SessionFactoryObjectFactory:39 - initializing class SessionFactoryObjectFactory
11:48:23,171 DEBUG SessionFactoryObjectFactory:76 - registered: 40288a47faf54d3700faf54d3a830000 (unnamed)
11:48:23,171  INFO SessionFactoryObjectFactory:82 - no JNDI name configured
11:48:23,171 DEBUG SessionFactoryImpl:196 - instantiated session factory
11:48:23,250 DEBUG SessionImpl:528 - opened session
11:48:23,250 DEBUG BatcherImpl:192 - about to open: 0 open PreparedStatements, 0 open ResultSets
11:48:23,250 DEBUG DriverManagerConnectionProvider:78 - total checked-out connections: 0
11:48:23,250 DEBUG DriverManagerConnectionProvider:84 - using pooled JDBC connection, pool size: 0
11:48:23,250 DEBUG SQL:223 - select nextval ('hibernate_sequence')
11:48:23,250 DEBUG BatcherImpl:227 - preparing statement
11:48:23,281 DEBUG JDBCExceptionReporter:36 - SQL Exception
java.sql.SQLException: ERROR:  Relation "hibernate_sequence" does not exist

   at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131)
   at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:505)
   at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:320)
   at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:48)
   at org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:153)
   at net.sf.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:69)
   at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:727)
   at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:717)
   at QueryEngine.runprog(QueryEngine.java:142)
   at QueryEngine.<init>(QueryEngine.java:39)
   at Myfe.actionPerformed(Myfe.java:111)
   at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
   at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
   at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
   at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
   at java.awt.Component.processMouseEvent(Component.java:5099)
   at java.awt.Component.processEvent(Component.java:4896)
   at java.awt.Container.processEvent(Container.java:1569)
   at java.awt.Component.dispatchEventImpl(Component.java:3614)
   at java.awt.Container.dispatchEventImpl(Container.java:1627)
   at java.awt.Component.dispatchEvent(Component.java:3476)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
   at java.awt.Container.dispatchEventImpl(Container.java:1613)
   at java.awt.Window.dispatchEventImpl(Window.java:1606)
   at java.awt.Component.dispatchEvent(Component.java:3476)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
11:48:23,281  WARN JDBCExceptionReporter:38 - SQL Error: 0, SQLState: null
11:48:23,281 ERROR JDBCExceptionReporter:46 - ERROR:  Relation "hibernate_sequence" does not exist

11:48:23,281 DEBUG BatcherImpl:199 - done closing: 0 open PreparedStatements, 0 open ResultSets
11:48:23,281 DEBUG BatcherImpl:240 - closing statement
11:48:23,296 DEBUG JDBCExceptionReporter:36 - SQL Exception
java.sql.SQLException: ERROR:  Relation "hibernate_sequence" does not exist

   at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131)
   at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:505)
   at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:320)
   at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:48)
   at org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:153)
   at net.sf.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:69)
   at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:727)
   at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:717)
   at QueryEngine.runprog(QueryEngine.java:142)
   at QueryEngine.<init>(QueryEngine.java:39)
   at Myfe.actionPerformed(Myfe.java:111)
   at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
   at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
   at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
   at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
   at java.awt.Component.processMouseEvent(Component.java:5099)
   at java.awt.Component.processEvent(Component.java:4896)
   at java.awt.Container.processEvent(Container.java:1569)
   at java.awt.Component.dispatchEventImpl(Component.java:3614)
   at java.awt.Container.dispatchEventImpl(Container.java:1627)
   at java.awt.Component.dispatchEvent(Component.java:3476)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
   at java.awt.Container.dispatchEventImpl(Container.java:1613)
   at java.awt.Window.dispatchEventImpl(Window.java:1606)
   at java.awt.Component.dispatchEvent(Component.java:3476)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
11:48:23,296  WARN JDBCExceptionReporter:38 - SQL Error: 0, SQLState: null
11:48:23,296 ERROR JDBCExceptionReporter:46 - ERROR:  Relation "hibernate_sequence" does not exist

11:48:23,296 ERROR JDBCExceptionReporter:38 - Could not save object
java.sql.SQLException: ERROR:  Relation "hibernate_sequence" does not exist

   at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131)
   at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:505)
   at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:320)
   at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:48)
   at org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:153)
   at net.sf.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:69)
   at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:727)
   at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:717)
   at QueryEngine.runprog(QueryEngine.java:142)
   at QueryEngine.<init>(QueryEngine.java:39)
   at Myfe.actionPerformed(Myfe.java:111)
   at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
   at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
   at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
   at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
   at java.awt.Component.processMouseEvent(Component.java:5099)
   at java.awt.Component.processEvent(Component.java:4896)
   at java.awt.Container.processEvent(Container.java:1569)
   at java.awt.Component.dispatchEventImpl(Component.java:3614)
   at java.awt.Container.dispatchEventImpl(Container.java:1627)
   at java.awt.Component.dispatchEvent(Component.java:3476)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
   at java.awt.Container.dispatchEventImpl(Container.java:1613)
   at java.awt.Window.dispatchEventImpl(Window.java:1606)
   at java.awt.Component.dispatchEvent(Component.java:3476)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
11:49:06,609 DEBUG SessionImpl:3239 - running Session.finalize()
11:49:06,609  WARN SessionImpl:3251 - unclosed connection


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 12:58 am 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
What is this:

java.sql.SQLException: ERROR: Relation "hibernate_sequence" does not exist


Your native id generator on Postgres is not working. Try something like:

Code:
            <generator class="sequence">
                <param name="sequence">DistributionChannelSeq</param>
            </generator>


Or create the hibernate_sequence sequence.



Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 1:03 am 
Beginner
Beginner

Joined: Thu Feb 19, 2004 6:07 am
Posts: 21
Ok - please disregard teh above stack trace. I got sequence to work
and was even able to insert some records - Forum and Poster records
were inserted fine.
But Post object was not saved correctly.
It changed the constructor for the object - you can see this in teh stack trace
Post(id, f_id, p_id, timestmp) - that's it - the other fields are stored
as null in the database.
Why is the sql query changing ? I.e. appearing to selectively select
some attributes and reject others and form a completely new Object ???
Really strange goings on ...Mmmm.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 10:42 am 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
You need to read the documentation more.

There is no need to explicitly have f_id and p_id properties - you just need the many to one associations with the column names.

To create your Post object with the associations to Forum and Poster, you do not explicitly put the ids of the Forum and Poster in the Post object. Read http://www.hibernate.org/hib_docs/reference/html/manipulating-data.html#manipulating-data-s1

By the looks of it, your Post class will be a mess. Check out http://www.hibernate.org/hib_docs/reference/html/persistent-classes.html . You could try running hbm2java using your mappings to see what it produces.


Sherman


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.