• Post Reply Bookmark Topic Watch Topic
  • New Topic

a question about hibernate + JBX

 
George Ren
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,everyone.
I want to select records from a database table using hibernate, and display the slected records in a JTable. There is nothing wrong in compile phase, but when I run the query, JBuilder X reported me a error. Below is the console information:

D:\JBuilderX\jdk1.4\bin\javaw -classpath "C:\Projects\Electric_Control\new\Electric_Control\classes;D:\JBuilderX\jdk1.4\lib\comm.jar;D:\hibernate-2.1\hibernate2.jar;D:\hibernate-2.1\lib\ant-1.5.3.jar;D:\hibernate-2.1\lib\ant-optional-1.5.3.jar;D:\hibernate-2.1\lib\c3p0-0.8.4.5.jar;D:\hibernate-2.1\lib\cglib-full-2.0.1.jar;D:\hibernate-2.1\lib\commons-collections-2.1.jar;D:\hibernate-2.1\lib\commons-dbcp-1.1.jar;D:\hibernate-2.1\lib\commons-lang-1.0.1.jar;D:\hibernate-2.1\lib\commons-logging-1.0.3.jar;D:\hibernate-2.1\lib\commons-pool-1 .1.jar;D:\hibernate-2.1\lib\concurrent-1.3.2.jar;D:\hibernate-2.1\lib\connector.jar;D:\hibernate-2.1\lib\dom4j-1.4.jar;D:\hibernate-2.1\lib\ehcache-0.7.jar;D:\hibernate-2.1\lib\jaas.jar;D:\hibernate-2.1\lib\jboss-cache.jar;D:\hibernate-2.1\lib\jboss-common.jar;D:\hibernate-2.1\lib\jboss-jmx.jar;D:\hibernate-2.1\lib\jboss-system.jar;D:\hibernate-2.1\lib\jcs-1.0-dev.jar;D:\hibernate-2.1\lib\jdbc2_0-stdext.jar;D:\hibernate-2.1\lib\jgroups-2.2.1.jar;D:\hibernate-2.1\lib\jta.jar;D:\hibernate-2.1\lib\ junit-3.8.1.jar;D:\hibernate-2.1\lib\log4j-1.2.8.jar;D:\hibernate-2.1\lib\odmg-3.0.jar;D:\hibernate-2.1\lib\oscache-2.0.jar;D:\hibernate-2.1\lib\proxool-0.8.3.jar;D:\hibernate-2.1\lib\swarmcache-1.0rc2.jar;D:\hibernate-2.1\lib\xalan-2.4.0.jar;D:\hibernate-2.1\lib\xerces-2.4.0.jar;D:\hibernate-2.1\lib\xml-apis.jar;D:\JBuilderX\jdk1.4\demo\jfc\Java2D\Java2Demo.jar;D:\JBuilderX\jdk1.4\demo\plugin\jfc\Java2D\Java2Demo.jar;D:\JBuilderX\jdk1.4\jre\javaws\javaws.jar;D:\JBuilderX\jdk1.4\jre\lib\charsets .jar;D:\JBuilderX\jdk1.4\jre\lib\ext\dnsns.jar;D:\JBuilderX\jdk1.4\jre\lib\ext\ldapsec.jar;D:\JBuilderX\jdk1.4\jre\lib\ext\localedata.jar;D:\JBuilderX\jdk1.4\jre\lib\ext\sunjce_provider.jar;D:\JBuilderX\jdk1.4\jre\lib\im\indicim.jar;D:\JBuilderX\jdk1.4\jre\lib\im\thaiim.jar;D:\JBuilderX\jdk1.4\jre\lib\jce.jar;D:\JBuilderX\jdk1.4\jre\lib\jsse.jar;D:\JBuilderX\jdk1.4\jre\lib\plugin.jar;D:\JBuilderX\jdk1.4\jre\lib\rt.jar;D:\JBuilderX\jdk1.4\jre\lib\sunrsasign.jar;D:\JBuilderX\jdk1.4\lib\dt.jar;D:\J BuilderX\jdk1.4\lib\htmlconverter.jar;D:\JBuilderX\jdk1.4\lib\tools.jar" gui.ElecCtrl
22:09:40,595 INFO Environment:462 - Hibernate 2.1.3

22:09:40,605 INFO Environment:496 - loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=com.mysql.jdbc.Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=net.sf.ehcache.hibernate.Provider, hibernate.cache.use_query_cache=true, hibernate.max_fetch_depth=1, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.jdbc.batch_size=0, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.connection.username=root, hibernate.cache.region_prefix=hibernate.test, hibernate.connection.url=jdbc:mysql:///Users, hibernate.connection.password=, hibernate.connection.pool_size=1}

22:09:40,675 INFO Environment:518 - using java.io streams to persist binary types

22:09:40,675 INFO Environment:519 - using CGLIB reflection optimizer

22:09:40,705 INFO Configuration:347 - Mapping resource: database/Data.hbm.xml

22:09:41,777 INFO Binder:229 - Mapping class: database.Data -> Data

22:09:41,917 INFO Configuration:613 - processing one-to-many association mappings

22:09:41,917 INFO Configuration:622 - processing one-to-one association property references

22:09:41,927 INFO Configuration:647 - processing foreign key constraints

22:09:42,047 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.MySQLDialect

22:09:42,047 INFO SettingsFactory:58 - Maximim outer join fetch depth: 1

22:09:42,057 INFO SettingsFactory:62 - Use outer join fetching: false

22:09:42,067 INFO DriverManagerConnectionProvider:42 - Using Hibernate built-in connection pool (not for production use!)

22:09:42,077 INFO DriverManagerConnectionProvider:43 - Hibernate connection pool size: 1

22:09:42,087 INFO DriverManagerConnectionProvider:77 - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql:///Users

22:09:42,087 INFO DriverManagerConnectionProvider:78 - connection properties: {user=root, password=}

22:09:42,097 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)

22:09:42,688 INFO SettingsFactory:102 - Use scrollable result sets: true

22:09:42,688 INFO SettingsFactory:105 - Use JDBC3 getGeneratedKeys(): true

22:09:42,688 INFO SettingsFactory:108 - Optimize cache for minimal puts: false

22:09:42,688 INFO SettingsFactory:117 - Query language substitutions: {no='N', true=1, yes='Y', false=0}

22:09:42,698 INFO SettingsFactory:128 - cache provider: net.sf.ehcache.hibernate.Provider

22:09:42,738 INFO Configuration:1093 - instantiating and configuring caches

22:09:42,998 INFO SessionFactoryImpl:119 - building session factory

net.sf.hibernate.PropertyNotFoundException: Could not find a setter for property id in class database.Data

at net.sf.hibernate.property.BasicPropertyAccessor.getSetter(BasicPropertyAccessor.java:131)

at net.sf.hibernate.mapping.Property.getSetter(Property.java:178)

at net.sf.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:576)

at net.sf.hibernate.persister.EntityPersister.<init>(EntityPersister.java:714)

at net.sf.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:42)

at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:137)

at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:768)

at gui.MainFrame_QueryBox.query(MainFrame_QueryBox.java:121)

at gui.MainFrame_QueryBox.jbQuery_actionPerformed(MainFrame_QueryBox.java:165)

at gui.MainFrame_QueryBox_jbQuery_actionAdapter.actionPerformed(MainFrame_QueryBox.java:187)

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:5100)

at java.awt.Component.processEvent(Component.java:4897)

at java.awt.Container.processEvent(Container.java:1569)

at java.awt.Component.dispatchEventImpl(Component.java:3615)

at java.awt.Container.dispatchEventImpl(Container.java:1627)

at java.awt.Component.dispatchEvent(Component.java:3477)

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:3477)

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.pumpEventsForHierarchy(EventDispatchThread.java:141)

at java.awt.Dialog$1.run(Dialog.java:540)

at java.awt.Dialog.show(Dialog.java:561)

at gui.MainFrame.jMenuUserQuery_actionPerformed(MainFrame.java:183)

at gui.MainFrame_jMenuUserQuery_actionAdapter.actionPerformed(MainFrame.java:422)

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.AbstractButton.doClick(AbstractButton.java:289)

at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1113)

at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:943)

at java.awt.Component.processMouseEvent(Component.java:5100)

at java.awt.Component.processEvent(Component.java:4897)

at java.awt.Container.processEvent(Container.java:1569)

at java.awt.Component.dispatchEventImpl(Component.java:3615)

at java.awt.Container.dispatchEventImpl(Container.java:1627)

at java.awt.Component.dispatchEvent(Component.java:3477)

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:3477)

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)

Exception occurred during event dispatching:

java.lang.NullPointerException

at gui.MainFrame_QueryBox.query(MainFrame_QueryBox.java:141)

at gui.MainFrame_QueryBox.jbQuery_actionPerformed(MainFrame_QueryBox.java:165)

at gui.MainFrame_QueryBox_jbQuery_actionAdapter.actionPerformed(MainFrame_QueryBox.java:187)

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:5100)

at java.awt.Component.processEvent(Component.java:4897)

at java.awt.Container.processEvent(Container.java:1569)

at java.awt.Component.dispatchEventImpl(Component.java:3615)

at java.awt.Container.dispatchEventImpl(Container.java:1627)

at java.awt.Component.dispatchEvent(Component.java:3477)

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:3477)

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.pumpEventsForHierarchy(EventDispatchThread.java:141)

at java.awt.Dialog$1.run(Dialog.java:540)

at java.awt.Dialog.show(Dialog.java:561)

at gui.MainFrame.jMenuUserQuery_actionPerformed(MainFrame.java:183)

at gui.MainFrame_jMenuUserQuery_actionAdapter.actionPerformed(MainFrame.java:422)

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.AbstractButton.doClick(AbstractButton.java:289)

at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1113)

at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:943)

at java.awt.Component.processMouseEvent(Component.java:5100)

at java.awt.Component.processEvent(Component.java:4897)

at java.awt.Container.processEvent(Container.java:1569)

at java.awt.Component.dispatchEventImpl(Component.java:3615)

at java.awt.Container.dispatchEventImpl(Container.java:1627)

at java.awt.Component.dispatchEvent(Component.java:3477)

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:3477)

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)




I don't know what setter is and please help~~~~

Thanks for helping.

Have a nice day
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi George,

We've got a whole forum devoted to ORM tools like Hibernate -- I'm going to move this question over there where it will get more attention.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!