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:26 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: MySQL 5.0.51b works fine though...
PostPosted: Wed Jun 25, 2008 3:01 pm 
Newbie

Joined: Wed Jun 25, 2008 9:37 am
Posts: 3
Hi, hopefully someone reads this eventually since I seem be the only one even viewing my post, but it should be noted that the exact same config for Seam (and by extension, hibernate) works fine against MySQL 5....so, the issue is apparently either in Hibernate (the postgres dialect for 8.3 maybe?) or in my config of postgres....

I'm prepared to expect that it is my config of postgres, BUT it's a basic (nothing tricky!) windows install of 8.3.1, and I'm running on localhost with the master account (full perms. obviously) so I'm at a loss as to what it could be....(remember...I'm getting tables back, but no knowledge of columns or primary keys!). I've modified the pg_hba.conf and postgres.conf, but since I'm local it shouldn't matter anyways....

I still need some help on this since although I can continue to develop on MySQL for the time being, deployment will be on a postgres DB....

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 12, 2008 7:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
I've heard before of postgressql having issues with reporting primary keys correctly - something about them only reporting them as unique keys. Unfortunately I can't remember the resolution on top of my head ;(

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: seam-gen postgre solution
PostPosted: Wed Jul 30, 2008 4:07 pm 
Newbie

Joined: Wed Jul 30, 2008 4:01 pm
Posts: 1
I think I found a solution for you, and me. It seems the key is to put the schema name and catalog name in place

[input] Enter the database schema name (it is OK to leave this blank) [publi
c] [public]

I USED "public" becuase it was there as shown in the pgAdmin III tool I was using to view my tables and run queries.

I also did the catalog that way

[input] Enter the database catalog name (it is OK to leave this blank) [publ
ic] [public]


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.