-->
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.  [ 13 posts ] 
Author Message
 Post subject: Exception in Hibernate: could not insert: [test.User#63]
PostPosted: Thu Jan 22, 2004 6:38 pm 
Regular
Regular

Joined: Mon Jan 19, 2004 10:39 pm
Posts: 84
Location: Nottingham, England
I am running hibente from within cocoon and postgresql. The above error message section, [test.User#63], increments by 1 everytime I refresh the browser, i.e a call is made to the table, a key(sequence) is obtained but nothing is written to the database. Can anybody tell me what I am not doing correctly?

My code s so:

1. persist class (snippet) - User.class

public User(){
}

public int getID() {
return userID;
}
public void setID(int newUserID) {
this.userID = newUserID;
}

public String getUserName() {
return (userName);
}
public void setUserName(String userName) {
this.userName = userName;
}

public String getPassword() {
return (password);
}
public void setPassword(String password) {
this.password = password;
}

public String getEmailAddress() {
return emailAddress;
}
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}

public Date getLastLogon() {
return lastLogon;
}
public void setLastLogon(Date newLastLogon) {
this.lastLogon = newLastLogon;
}

2. main class (snippet)

public void add(){
try {
Configuration cfg = new Configuration()
.configure ();
SessionFactory sf = cfg.buildSessionFactory();
Session session = sf.openSession();
Transaction transaction = session.beginTransaction();

User usr = new User();
usr.setID(1);
usr.setUserName("postgres");
usr.setPassword("postgres");
usr.setEmailAddress("test@hotmail.com");
usr.setLastLogon(newDate);

session.save(usr);
//session.flush();
transaction.commit();


}
catch (Exception e) {
System.out.println("Exception in Hibernate:" + e.getMessage());
}

3. hibernate.cfg.xml (snippet)

<property name="connection.driver">org.postgresql.Driver</property>
<property name="connection.url">jdbc:postgresql://localhost:5432/mydb</property>
<property name="connection.username">usr</property>
<property name="connection.password">pwd</property>
<property name="connection.pool_size">5</property>
<property name="jdbc.batch_size">0</property>
<property name="jdbc.use_scrollable_resultsets">true</property>
<property name="show_sql">true</property>
<property name="use_outer_join">true</property>
<property name="dialect">net.sf.hibernate.dialect.PostgreSQLDialect</property>

<mapping resource="test/User2.hbm.xml"/>

4 User2.hbm.xml (snippet)

<hibernate-mapping package="test">
<class name="User" table="users">
<id name="ID" type="integer" column="LogonID" unsaved-value="null">
<generator class="sequence">
<param name="sequence">seq_id_mytable</param>
</generator>
</id>

<property name="userName" column="Name" />
<property name="password" column="Password" />
<property name="emailAddress" column="EmailAddress" />
<property name="lastLogon" column="Lastlogon" />

</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 6:40 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Well for a starter unsaved-value="null" for a property of type int looks pretty strange to me. If thats not it, Please show a more detailed error message and log excerpt.


Top
 Profile  
 
 Post subject: Exception in Hibernate: could not insert: [test.User#64]
PostPosted: Thu Jan 22, 2004 6:56 pm 
Regular
Regular

Joined: Mon Jan 19, 2004 10:39 pm
Posts: 84
Location: Nottingham, England
gloeglm,
I have made the change you suggested, <id name="ID" type="integer" column="LogonID">, but the outcome is still the same. As I have copied the required *.jar files into the cocoon environment, do you have any idea where the log files would be generated for hibernate, as I looked high and low but cannot find anything?

thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 6:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Don't know, where does cocoon log? If it uses log4j, it might be mixed in there somewhere. or check stdout of your appserver. Or something like that :)


Top
 Profile  
 
 Post subject: Error logs as requested...
PostPosted: Thu Jan 22, 2004 8:02 pm 
Regular
Regular

Joined: Mon Jan 19, 2004 10:39 pm
Posts: 84
Location: Nottingham, England
gloeglm,
finaly, here is the breakdown you requested... I have added a table schema as well...

1. schema

CREATE TABLE "users" (
"Name" character varying(40),
"Password" character varying(20),
"EmailAddress" character varying(40),
"Lastlogon" date DEFAULT now(),
"LogonID" integer NOT NULL DEFAULT nextval('seq_id_mytable'::text)
) WITH OIDS;

2. error log

- configuring from resource: /hibernate.cfg.xml
- Configuration resource: /hibernate.cfg.xml
- Mapping resource: test/User2.hbm.xml
- Mapping class: test.User -> users
- Configured SessionFactory: null
- processing one-to-many association mappings
- processing one-to-one association property references
- processing foreign key constraints
- Using dialect: net.sf.hibernate.dialect.PostgreSQLDialect
- Use outer join fetching: true
- Using Hibernate built-in connection pool (not for production use!)
- Hibernate connection pool size: 5
- using driver: org.postgresql.Driver at URL: jdbc:postgresql://localhost:5432/mydb
- connection properties: {user=usr, password=pwd}
- No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
- Use scrollable result sets: true
- echoing all SQL to stdout
- Query language substitutions: {}
- cache provider: net.sf.ehcache.hibernate.Provider
- instantiating and configuring caches
- building session factory
- no JNDI name configured
Hibernate: select nextval ('seq_id_mytable')
Hibernate: insert into users (Name, Password, EmailAddress, Lastlogon, LogonID) values (?, ?, ?, ?, ?)
- SQL Error: 0, SQLState: 42703
- ERROR: column "name" of relation "users" does not exist

- could not insert: [test.User#72]
org.postgresql.util.PSQLException: ERROR: column "name" of relation "users" does not exist

at org.postgresql.util.PSQLException.parseServerError(PSQLException.java:139)
at org.postgresql.core.QueryExecutor.executeV3(QueryExecutor.java:154)
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:101)
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:43)
at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:515)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:50)
at org.postgresql.jdbc1.AbstractJdbc1Statement.executeUpdate(AbstractJdbc1Statement.java:271)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:469)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:443)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2308)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2261)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2187)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at test.User2.add(User2.java:31)
at org.apache.cocoon.www.userhomes.test_xml.generate(org.apache.cocoon.www.userhomes.test_xml:138)
at org.apache.cocoon.generation.ServerPagesGenerator.generate(ServerPagesGenerator.java:262)
at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:557)
at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:196)
at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:501)
at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:147)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:84)
at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:164)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:163)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:152)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:354)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:307)
at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:133)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:84)
at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:164)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:163)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:152)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:354)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:307)
at org.apache.cocoon.Cocoon.process(Cocoon.java:656)
at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1112)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:261)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:360)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:604)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:562)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:679)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:554)
- Could not synchronize database state with session
net.sf.hibernate.JDBCException: could not insert: [test.User#72]
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:479)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:443)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2308)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2261)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2187)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at test.User2.add(User2.java:31)
at org.apache.cocoon.www.userhomes.test_xml.generate(org.apache.cocoon.www.userhomes.test_xml:138)
at org.apache.cocoon.generation.ServerPagesGenerator.generate(ServerPagesGenerator.java:262)
at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:557)
at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:196)
at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:501)
at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:147)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:84)
at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:164)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:163)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:152)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:354)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:307)
at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:133)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:84)
at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:164)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:163)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:152)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:354)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:307)
at org.apache.cocoon.Cocoon.process(Cocoon.java:656)
at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1112)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:261)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:360)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:604)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:562)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:679)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:554)
Caused by: org.postgresql.util.PSQLException: ERROR: column "name" of relation "users" does not exist

at org.postgresql.util.PSQLException.parseServerError(PSQLException.java:139)
at org.postgresql.core.QueryExecutor.executeV3(QueryExecutor.java:154)
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:101)
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:43)
at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:515)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:50)
at org.postgresql.jdbc1.AbstractJdbc1Statement.executeUpdate(AbstractJdbc1Statement.java:271)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:469)
... 64 more
Exception in Hibernate:could not insert: [test.User#72]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 23, 2004 3:41 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
name -> Name

_________________
Emmanuel


Top
 Profile  
 
 Post subject: Hibernate still will not insert to table....
PostPosted: Fri Jan 23, 2004 5:13 am 
Regular
Regular

Joined: Mon Jan 19, 2004 10:39 pm
Posts: 84
Location: Nottingham, England
Emmanuel,
thanks for your reply, but i'm not sure I understand what you mean. The parameter 'Name' references the column 'Name' in the users table. I have changed name from 'Name' to 'NAME' and back again but with no change to the final result. Could you please explain what you mean?

many thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 23, 2004 6:44 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Well

Code:
insert into users (Name, Password, EmailAddress, Lastlogon, LogonID) values (?, ?, ?, ?, ?)
ERROR: column "name" of relation "users" does not exist

is really a DB problem. If you cant execute this query by hand, the problem is not on Hibernates side. Something with your column mappings is wrong.


Top
 Profile  
 
 Post subject: Problem solved....
PostPosted: Fri Jan 23, 2004 7:06 am 
Regular
Regular

Joined: Mon Jan 19, 2004 10:39 pm
Posts: 84
Location: Nottingham, England
The column names in my postgresql table started with capital letters, so I changed them all to lowercase and all works fine now! WOW 4 days for such a simple thing! Thanks for all your help though ;-)
Based on the log outputs I have a few performance related issues to ask.

- Hibernate 2.1.1

- loaded properties from resource hibernate.properties:

{hibernate.connection.driver_class=org.postgresql.Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.sf.hibernate.dialect.PostgreSQLDialect, hibernate.jdbc.batch_size=0, hibernate.use_outer_join=false, hibernate.connection.username=postgres, hibernate.jdbc.use_scrollable_resultset=false, hibernate.connection.url=jdbc:postgresql://localhost:5432/test, hibernate.show_sql=true, hibernate.connection.password=postgres, hibernate.connection.pool_size=0}

1. Do I need to specify the hibernate.properties file if I have sessionFactory = new Configuration().configure().buildSessionFactory() specified which pulls in hibernate.cfg.xml which itself property parameters specified anyway?

- using CGLIB reflection optimizer
- configuring from resource: /hibernate.cfg.xml
- Configuration resource: /hibernate.cfg.xml
- Mapping resource: test/User2.hbm.xml
- Mapping class: test.User -> users

- Configured SessionFactory: null
2. Is SessionFactory being null a problem?

- processing one-to-many association mappings
- processing one-to-one association property references
- processing foreign key constraints
- Using dialect: net.sf.hibernate.dialect.PostgreSQLDialect
- Use outer join fetching: false

- Using Hibernate built-in connection pool (not for production use!)
3. I believe that there are other ways of connection pooling through JNDI? How do I achieve this with Apache/Tomcat?

- Hibernate connection pool size: 0
- using driver: org.postgresql.Driver at URL: jdbc:postgresql://localhost:5432/test
- connection properties: {user=postgres, password=postgres}

- No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
4. How do I resolve this issue?

- Use scrollable result sets: false
5. As the postgresql jdbc driver doesn't support batch updates, do I have to have result sets, set to false and how will this impact on my design choices?

- echoing all SQL to stdout
- Query language substitutions: {}
- cache provider: net.sf.ehcache.hibernate.Provider
- instantiating and configuring caches
- building session factory

- no JNDI name configured
6. Is this an issue? Should it be configured, and woud it improve performace if it was configured?

Hibernate: select nextval ('seq_id_mytable')
Hibernate: insert into users (name, password, emailaddress, lastlogon, LogonID) values (?, ?, ?, ?, ?)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 23, 2004 7:14 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
1. No if you use hibernate.cfg.xml you can drop hibernate.properties
2. Most likely not, if it works :)
3. Refer to the Tomcat documentation on how to setup a tomcat connection pool. Then set the appropriate parameters for hibernate (http://www.hibernate.org/hib_docs/reference/html/session-configuration.html#session-configuration-s4
4. This is no problem as long as you are not in a JTA environment (eg. full application server)
5. This should be automatically detected, most likely your driver just does not support scrollable results
6. No.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 23, 2004 7:17 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
ps: you can also use another connection pool (DBCP, c3po, proxool) instead of the builtin one


Top
 Profile  
 
 Post subject: Performance issues....
PostPosted: Fri Jan 23, 2004 7:30 am 
Regular
Regular

Joined: Mon Jan 19, 2004 10:39 pm
Posts: 84
Location: Nottingham, England
gloeglm, thanks for those recommendations. I will try them out ;-).


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 07, 2007 8:20 am 
Beginner
Beginner

Joined: Wed May 23, 2007 1:07 pm
Posts: 28
Regarding this topic, the problem was the use of capital letters in PostgreSQL

The original poster should have written the table name and column names like `User` or `Name` - in between ``.


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