This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
This bug was originally marked as duplicate of bug 168637, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related. Build: NetBeans IDE 6.9 (Build 201011082200) VM: Java HotSpot(TM) Client VM, 17.0-b16, Java(TM) SE Runtime Environment, 1.6.0_21-b06 OS: Linux User Comments: GUEST: error creating jpa entity on postgresql database, the column datatypes are postgresql domains . perhaps jpa can't translate domain name to datatype GUEST: i was generating Entity Classes from Database using the Wizard GUEST: Creando las clases de persistencia de mi BD GUEST: Trying to generate POJO from a database GUEST: This error when i create new CMP Entity Beans From Database GUEST: I try to create CMP Entity Bean from Database use JDBC-ODBC Bridge. After Add Table and Finish, I can't create CMP Entity Bean because this error bmm: Generating Classes from Database GUEST: I was creating entity clasess from a Postgres database orejas: jpa entity class wizard can't translate postgresql domain to data type. example create domain codigo as integer; create domain campotexto as varchar(40); create table prueba ( campo1 codigo constraint prueba_key primary key, campo2 campotexto); GUEST: create entity classes with mssql2005 std GUEST: create entity from data base GUEST: generating a Java Persistance class from a schema GUEST: Auto generate entity classes from a SQL Server 2005 Express database. GUEST: Creating a class from a database table netbeans2008: When I tried to create entities from database, this exception happend for almost 60%-70% of the tables; therefore, no entities created. Furthermore, if I select multiple tables at a time to generate multiple entities, it never works. OS: Vista Database: SQL Server 2008 Network: LAN jrhall3: I was creating persistence classes classes from sqlserver database tables keeperlink: I was trying to create JPA entity class on table from SQL server. Below is the table structure: CREATE TABLE [dbo].[cardque] ( [merchant_number] [int] NOT NULL , [sales_order_number] [int] NOT NULL , [c] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [requesting_user] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [date_created] [datetime] NOT NULL , [rowguid] uniqueidentifier ROWGUIDCOL NOT NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[cardque] WITH NOCHECK ADD CONSTRAINT [PK_cardque] PRIMARY KEY CLUSTERED ( [merchant_number], [sales_order_number], [requesting_user], [date_created] ) ON [PRIMARY] GO ALTER TABLE [dbo].[cardque] WITH NOCHECK ADD CONSTRAINT [DF_cardque_c] DEFAULT ('') FOR [c], CONSTRAINT [DF_cardque_requesting_user] DEFAULT ('') FOR [requesting_user], CONSTRAINT [DF_cardque_date_created] DEFAULT (getdate()) FOR [date_created], CONSTRAINT [DF__cardque__rowguid__20AFFFE7] DEFAULT (newid()) FOR [rowguid] GO CRE GUEST: Problem during generation Entity Classes from MS Access database (latest HXTT driver). With full recreation information GUEST: can't generate classes from database ! GUEST: java.lang.IllegalArgumentException: aType == null cannot create entity class from database GUEST: jpa can't translate postgresql domain to datatypes lmingoti: I was using the "Create entities from database" wizard. jkak: Creating EntityBeans from Database GUEST: postgresql entities ikhwanma@gmail.com: error during generating entity classes. using mssql2005 std database. Stacktrace: java.lang.IllegalArgumentException: aType == null at org.netbeans.modules.j2ee.persistence.entitygenerator.EntityMember.setMemberType(EntityMember.java:252) at org.netbeans.modules.j2ee.persistence.entitygenerator.DbSchemaEntityMember.setPrimaryKey(DbSchemaEntityMember.java:127) at org.netbeans.modules.j2ee.persistence.entitygenerator.DbSchemaEjbGenerator.generatePkField(DbSchemaEjbGenerator.java:441) at org.netbeans.modules.j2ee.persistence.entitygenerator.DbSchemaEjbGenerator.buildCMPSet(DbSchemaEjbGenerator.java:537) at org.netbeans.modules.j2ee.persistence.entitygenerator.DbSchemaEjbGenerator.<init>(DbSchemaEjbGenerator.java:111) at org.netbeans.modules.j2ee.persistence.wizard.fromdb.RelatedCMPHelper.buildBeans(RelatedCMPHelper.java:332)
Created attachment 103421 [details] stacktrace
What is "domain type" column type for Postgresql? It looks most issues are related to handling of this domain type, how to create a table with domain type column? Is it possible to create schema from your tables in nb?
reply: When create a database schema, all fields in a table are data type DISTINCT. postgresql use a Domain to encapsula a data type: Example Create a domain called CODE, then all fields that are key you can define as code instead of integer. When JDBC read metadata, in position 5 of getcolumns you receive java.sql.Types.OTHER, then you must query a table like that select <fieldname> from <table> where null=null, querying the metadata resultset, obtain the real datatype. Database example. create domain code as integer create table table1 (field1 code, field2 varchar(20)); select field1 from table1 where null=null then query the metadata resultset, obtain the real datatype.
update: Sorry, i found the problem where resultset metada return data type other or data type distinct you must return then data in position 22(SOURCE_DATA_TYPE) of getColumns. This is valid for postgresql jdbc3 of version 8.3+.
I can reproduce the issue with Postgres 8.4, and corresponding jdbc4 driver. I can generate dbschema but it will contain DISTINCT types for domain types columns, shouldn't it be resolved to actual type at dbschema creation step?
don't see good way on persistence side, please push back if i miss something in db/schema I can use.
I understand the problem but I not sure where is a proper place to workaround this fact in mapping domain type in PostgreSQL.
Thanks Sergey for your hint. It's been fixed in dbschema code. Please, verify if it's working correctly. Thanks core-main/rev/30b92b21fb12
Integrated into 'main-golden', will be available in build *201012090001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/30b92b21fb12 User: Jiri Rechtacek <jrechtacek@netbeans.org> Log: #192609: IllegalArgumentException: aType == null
*** Bug 194608 has been marked as a duplicate of this bug. ***