-->
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.  [ 4 posts ] 
Author Message
 Post subject: weirdness using seam-gen against postgres?
PostPosted: Wed Jun 25, 2008 10:24 am 
Newbie

Joined: Wed Jun 25, 2008 9:37 am
Posts: 3
Hi,

I'm using seam generate-entities to reverse-eng a database for a basic CRUD app...at least I'm trying to...while there are no exceptions or anything, and Hibernate DOES seem to acquire a certain level of knowledge about my Db (it knows what tables exist!) it doesn't generate any pojos, giving messages about "no primary keys" and "no columns found" for the given tables...

How is this possible? It connects to the database, finds the tables, but can't see beyond that? My seam-gen config is basic, and others don't seem to have a problem with similar configurations....my postgres db setup is default and I'm running on localhost using the master account to login!

I've seen *similar* issues around the interweb, but the dealt with oracle, and the solutions that worked for them did not work for me (providing all-caps schema names, putting the connection info directly into the URL and directly calling out localhost and port info, I've tried both specifying and NOT specifying schema and catalogs)

To re-iterate, i don't *think* this is a db config issue - using the eclipse Data Source Explorer, I am able navigate down and see my tables - including the columns and primary keys defined therein....

BTW, this is all running on localhost, on winXp pro, if that means anything to you as far as issue identification (though connecting to a remote install of postgres also produced the same warnings)

Hibernate version:
unsure - recent though; the one bundled with seam 2.0.2 sp1

Full stack trace of any exception that occurs:
no exceptions - just some log warnings...here is an excerpt from the full log that is specifically the problem I'm trying to fix:

Code:
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.reveng.JDBCReader processPrimaryKey
[hibernate] WARNING: The JDBC driver didn't report any primary key columns in MyTable. Asking rev.eng. strategy
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.reveng.JDBCReader processPrimaryKey
[hibernate] WARNING: Rev.eng. strategy did not report any primary key columns for MyTable
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.JDBCBinder createPersistentClasses
[hibernate] WARNING: Cannot create persistent class for org.hibernate.mapping.Table(myapp.MyTable) as no columns were found.



Name and version of the database you are using:
postgres 8.3.1; also tested against postgres 8.2.5 - same freaking problem - I've tried both the JDBC3 and JDBC4 driver flavours for each version of postgres too...just for good measure.

Debug level Hibernate log excerpt:

Code:
generate-model:
     [echo] Reverse engineering database using JDBC driver c:\java\postgresql-8.2-506.jdbc3.jar
     [echo] project=c:/java/workspace/myapppg825
     [echo] model=com.mycompany.myapp.beans
[hibernate] Executing Hibernate Tool with a JDBC Configuration (for reverse engineering)
[hibernate] 1. task: hbm2java (Generates a set of .java files)
[hibernate] Jun 25, 2008 9:57:36 AM org.hibernate.cfg.Environment <clinit>
[hibernate] INFO: Hibernate 3.2.4.sp1
[hibernate] Jun 25, 2008 9:57:36 AM org.hibernate.cfg.Environment <clinit>
[hibernate] INFO: hibernate.properties not found
[hibernate] Jun 25, 2008 9:57:36 AM org.hibernate.cfg.Environment buildBytecodeProvider
[hibernate] INFO: Bytecode provider name : cglib
[hibernate] Jun 25, 2008 9:57:36 AM org.hibernate.cfg.Environment <clinit>
[hibernate] INFO: using JDK 1.4 java.sql.Timestamp handling
[hibernate] Jun 25, 2008 9:57:36 AM org.hibernate.cfg.reveng.OverrideRepository addFile
[hibernate] INFO: Override file: c:\java\workspace\myapppg825\resources\seam-gen.reveng.xml
[hibernate] Jun 25, 2008 9:57:36 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernate] INFO: Using Hibernate built-in connection pool (not for production use!)
[hibernate] Jun 25, 2008 9:57:36 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernate] INFO: Hibernate connection pool size: 20
[hibernate] Jun 25, 2008 9:57:36 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernate] INFO: autocommit mode: false
[hibernate] Jun 25, 2008 9:57:36 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernate] INFO: using driver: org.postgresql.Driver at URL: jdbc:postgresql://localhost:5433/postgres
[hibernate] Jun 25, 2008 9:57:36 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernate] INFO: connection properties: {user=postgres, password=****}
[hibernate] Jun 25, 2008 9:57:36 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: RDBMS: PostgreSQL, version: 8.2.5
[hibernate] Jun 25, 2008 9:57:36 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 8.2 JDBC3 with SSL (build 506)
[hibernate] Jun 25, 2008 9:57:36 AM org.hibernate.dialect.Dialect <init>
[hibernate] INFO: Using dialect: org.hibernate.dialect.PostgreSQLDialect
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
[hibernate] INFO: Using default transaction strategy (direct JDBC transactions)
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
[hibernate] INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Automatic flush during beforeCompletion(): disabled
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Automatic session close at end of transaction: disabled
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: JDBC batch size: 15
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: JDBC batch updates for versioned data: disabled
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Scrollable result sets: enabled
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: JDBC3 getGeneratedKeys(): disabled
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Connection release mode: auto
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Default batch fetch size: 1
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Generate SQL with comments: disabled
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Order SQL updates by primary key: disabled
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Order SQL inserts for batching: disabled
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
[hibernate] INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
[hibernate] INFO: Using ASTQueryTranslatorFactory
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Query language substitutions: {}
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: JPA-QL strict compliance: disabled
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Second-level cache: enabled
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Query cache: disabled
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory createCacheProvider
[hibernate] INFO: Cache provider: org.hibernate.cache.HashtableCacheProvider
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Optimize cache for minimal puts: disabled
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Structured second-level cache entries: disabled
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Statistics: disabled
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Deleted entity synthetic identifier rollback: disabled
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Default entity-mode: pojo
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Named query checking : enabled
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.reveng.JDBCReader processPrimaryKey
[hibernate] WARNING: The JDBC driver didn't report any primary key columns in MyTable. Asking rev.eng. strategy
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.reveng.JDBCReader processPrimaryKey
[hibernate] WARNING: Rev.eng. strategy did not report any primary key columns for MyTable
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.cfg.JDBCBinder createPersistentClasses
[hibernate] WARNING: Cannot create persistent class for org.hibernate.mapping.Table(myapp.MyTable) as no columns were found.
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.connection.DriverManagerConnectionProvider close
[hibernate] INFO: cleaning up connection pool: jdbc:postgresql://localhost:5433/postgres
[hibernate] Jun 25, 2008 9:57:37 AM org.hibernate.tool.Version <clinit>
[hibernate] INFO: Hibernate Tools 3.2.0.CR1
[javaformatter] Java formatting of 0 files completed. Skipped 0 file(s).

generate-ui:
     [echo] Building project 'myapppg825' to generate views and controllers

init:

compile:
    [javac] Compiling 1 source file to c:\java\workspace\myapppg825\exploded-archives\myapppg825.jar

copyclasses:

jar:
     [copy] Copying 1 file to c:\java\workspace\myapppg825\exploded-archives\myapppg825.jar\META-INF
     [copy] Copying 1 file to c:\java\workspace\myapppg825\exploded-archives\myapppg825.jar
[hibernate] Executing Hibernate Tool with a JPA Configuration
[hibernate] 1. task: generic exportertemplate: view/list.xhtml.ftl
[hibernate] Jun 25, 2008 9:57:38 AM org.hibernate.cfg.annotations.Version <clinit>
[hibernate] INFO: Hibernate Annotations 3.3.0.GA
[hibernate] Jun 25, 2008 9:57:38 AM org.hibernate.ejb.Version <clinit>
[hibernate] INFO: Hibernate EntityManager 3.3.1.GA
[hibernate] 2. task: generic exportertemplate: view/view.xhtml.ftl
[hibernate] 3. task: generic exportertemplate: view/view.page.xml.ftl
[hibernate] 4. task: generic exportertemplate: view/edit.xhtml.ftl
[hibernate] 5. task: generic exportertemplate: view/edit.page.xml.ftl
[hibernate] 6. task: generic exportertemplate: src/EntityList.java.ftl
[hibernate] 7. task: generic exportertemplate: view/list.page.xml.ftl
[hibernate] 8. task: generic exportertemplate: src/EntityHome.java.ftl
[hibernate] 9. task: generic exportertemplate: view/layout/menu.xhtml.ftl
[javaformatter] Java formatting of 1 files completed. Skipped 0 file(s).
     [echo] Type 'seam restart' and go to http://localhost:8080/myapppg825

generate:

generate-entities:

BUILD SUCCESSFUL
Total time: 3 seconds



Thanks for any help anyone can provide.

Also, this community should be called "The hiberNation"....just an idea ;)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2008 6:26 am 
Beginner
Beginner

Joined: Sun Jul 31, 2005 6:15 pm
Posts: 28
Hi Guy

My Answer is very late, I know but should be useful for others who read your post.

We met a similar problem on DB2, and we finally found out this was due to a bad definition of the shema.

Actualy executing

db2 list tables for schema myschema

return no tables

Capitlizing the schema name solve the problem actually, I know it's weird but it worked for us.

And then hibernate-tool work fine again.

Good luck.

_________________
Michael Courcy


Top
 Profile  
 
 Post subject: Double Post, should not happen with seam ;-)
PostPosted: Thu Nov 13, 2008 6:27 am 
Beginner
Beginner

Joined: Sun Jul 31, 2005 6:15 pm
Posts: 28
Hi Guy

My Answer is very late, I know but should be useful for others who read your post.

We met a similar problem on DB2, and we finally found out this was due to a bad definition of the shema.

Actualy executing

db2 list tables for schema myschema

return no tables

Capitlizing the schema name solve the problem actually, I know it's weird but it worked for us.

And then hibernate-tool work fine again.

Good luck.

_________________
Michael Courcy


Top
 Profile  
 
 Post subject: Re: weirdness using seam-gen against postgres?
PostPosted: Wed Jun 01, 2011 12:20 am 
Newbie

Joined: Fri Feb 09, 2007 4:59 am
Posts: 2
This is due to a weirdness in POSTGRES. Just make sure all the tables and column names are in lower case and then retry. This will work.

_________________
M. M. Islam Chisty


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