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.

Bug 157286 - IllegalArgumentException: aType == null
Summary: IllegalArgumentException: aType == null
Status: RESOLVED INCOMPLETE
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: Sergey Petrov
URL: http://statistics.netbeans.org/except...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-22 02:47 UTC by familygw
Modified: 2010-03-30 14:15 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 58282


Attachments
stacktrace (1.28 KB, text/plain)
2009-01-22 02:47 UTC, familygw
Details
Test database (1.60 KB, text/plain)
2010-03-29 13:45 UTC, dratri
Details
sqljdbc driver that do not generate this bug (247.19 KB, application/octet-stream)
2010-03-29 15:03 UTC, dratri
Details
I have bug when I using thi driver (455.43 KB, application/octet-stream)
2010-03-29 15:04 UTC, dratri
Details

Note You need to log in before you can comment on or make changes to this bug.
Description familygw 2009-01-22 02:47:11 UTC
Build: NetBeans IDE 6.5 (Build 200812050001)
VM: Java HotSpot(TM) 64-Bit Server VM, 10.0-b23, Java(TM) SE Runtime Environment, 1.6.0_07-b06
OS: Windows Server 2008, 6.0, amd64

User Comments:
jkak: Creating EntityBeans from Database

GUEST: I was creating entity clasess from a Postgres database

GUEST: can't generate classes from database !

GUEST: Problem during generation Entity Classes from MS Access database (latest HXTT driver). With full recreation information

GUEST: create entity classes with mssql2005 std

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:213)
        at org.netbeans.modules.j2ee.persistence.entitygenerator.DbSchemaEntityMember.setPrimaryKey(DbSchemaEntityMember.java:124)
        at org.netbeans.modules.j2ee.persistence.entitygenerator.DbSchemaEjbGenerator.generatePkField(DbSchemaEjbGenerator.java:399)
        at org.netbeans.modules.j2ee.persistence.entitygenerator.DbSchemaEjbGenerator.buildCMPSet(DbSchemaEjbGenerator.java:488)
        at org.netbeans.modules.j2ee.persistence.entitygenerator.DbSchemaEjbGenerator.<init>(DbSchemaEjbGenerator.java:86)
        at org.netbeans.modules.j2ee.persistence.wizard.fromdb.RelatedCMPHelper.buildBeans(RelatedCMPHelper.java:310)
Comment 1 familygw 2009-01-22 02:47:16 UTC
Created attachment 76121 [details]
stacktrace
Comment 2 familygw 2009-01-22 03:12:30 UTC
I found the problem.
In the tables of the database wich I use, had a bad identity's definitions.

I hope wich this "tip", can help you.
Comment 3 familygw 2009-05-23 02:26:09 UTC
The root problem is the jodbc driver of Microsoft SQL Server.
Comment 4 vincent_kwinsey 2009-10-21 22:40:51 UTC
I had this problem in NB6.5.1 with PostgreSQL and I specifically tried NB6.7 - the problem remains. So - I reopen this 
case. It would be nice to get at least hint what has been done in NB to resolve this issue.
Comment 5 Sergey Petrov 2009-10-22 06:09:47 UTC
can you provide  version for jdbc driver and sql used to create tables in your database or/and database schema?
Comment 6 dratri 2010-03-29 13:45:39 UTC
Created attachment 96208 [details]
Test database

Test database.
12 tables with different primary key datatype.
8 tables with foreign key on nchar,nvarchar.
Comment 7 Sergey Petrov 2010-03-29 13:52:33 UTC
reopening, need to reevaluate with new information
Comment 8 dratri 2010-03-29 14:03:00 UTC
I included my test database.
According to 
org.netbeans.modules.j2ee.persistence.entitygenerator.EntityMember.setMemberType(EntityMember.java:213)
I read the EntityMember.java and I think this bug might have something to do with sql datatype.
I tested with both SQL Server 2005 Express v9.00.4053.00 and SQL Server 2008 Developer v10.0.2531.0 and I see that only tables with primary key are nchar or nvarchar data type can not be generated. 
(I am using jdk 1.6.0_07, sqljdbc4, NetBeans 6.5.1 Build 200811100001, windows 7)
This is not true for my friends' PCs.
Might be there are some problems with the unicode font?
Comment 9 dratri 2010-03-29 14:04:26 UTC
I included my test database.
According to 
org.netbeans.modules.j2ee.persistence.entitygenerator.EntityMember.setMemberType(EntityMember.java:213)
I read the EntityMember.java and I think this bug might have something to do
with sql datatype.
I tested with both SQL Server 2005 Express v9.00.4053.00 and SQL Server 2008
Developer v10.0.2531.0 and I see that only tables with primary key are nchar or
nvarchar data type can not be generated. 
(I am using jdk 1.6.0_07, sqljdbc4, NetBeans 6.5.1 Build 200811100001, windows
7)
This is not true for my friends' PCs.
Might be there are some problems with the unicode font?
Comment 10 Sergey Petrov 2010-03-29 14:15:43 UTC
anyway can't be fixed in 6.8, no sense to set 6.8 as target it may be hard to fit in 6.9 also as only a few weeks left.
can't say anything yet, will try to look after issue I'm working on.

do you mean you are able to generate enities with nchar on one pc and can't on another?
Comment 11 dratri 2010-03-29 14:17:55 UTC
(In reply to comment #10)
> anyway can't be fixed in 6.8, no sense to set 6.8 as target it may be hard to
> fit in 6.9 also as only a few weeks left.
> can't say anything yet, will try to look after issue I'm working on.
> 
> do you mean you are able to generate enities with nchar on one pc and can't on
> another?

Yes, that's right.
Comment 12 Sergey Petrov 2010-03-29 14:23:07 UTC
Are there any differences in db server, java, nb version, os?
Comment 13 Sergey Petrov 2010-03-29 14:23:52 UTC
The issue may depend on different jdbc drivers usage.
Comment 14 dratri 2010-03-29 14:37:31 UTC
(In reply to comment #13)
> The issue may depend on different jdbc drivers usage.
I have just asked 2 friends :
1PC window xp pro sp2, same NB, sql server 2005 express, jdk 1.6, sqljdbc.jar : no bug
1 laptop win7 , NB 6.5, sql server 2005, jdk 1.6, sqljdbc.jar : no bug.
(me sqljdbc4)
Comment 15 Sergey Petrov 2010-03-29 14:41:23 UTC
do you know sqljdbc.jar version?
Also do you use sqljdbc4? Can you try sqljdbc?
Comment 16 dratri 2010-03-29 14:57:37 UTC
(In reply to comment #15)
> do you know sqljdbc.jar version?
> Also do you use sqljdbc4? Can you try sqljdbc?

I try sqljdbc.jar (I dont know what version, but it's size is 247KB)
and no more bug.
Comment 17 dratri 2010-03-29 15:03:09 UTC
Created attachment 96236 [details]
sqljdbc driver that do not generate this bug
Comment 18 dratri 2010-03-29 15:04:48 UTC
Created attachment 96237 [details]
I have bug when I using thi driver

Thanks for your direction.
Comment 19 Sergey Petrov 2010-03-29 15:08:26 UTC
Now it looks more
like jdbc driver compatibility either with nb or with db issue and if I got it
right proper driver exists.
The issue itself may be considered as valid but nor severe as it may be better
to provider some message like "can't resolve primary key type" instead of
throwing exception.
Comment 20 dratri 2010-03-29 15:13:39 UTC
(In reply to comment #19)
> Now it looks more
> like jdbc driver compatibility either with nb or with db issue and if I got it
> right proper driver exists.
> The issue itself may be considered as valid but nor severe as it may be better
> to provider some message like "can't resolve primary key type" instead of
> throwing exception.

I've posted 2 drivers, 1 no bug 1 buggy.
Do you need anymore information ?
Comment 21 Sergey Petrov 2010-03-29 15:17:20 UTC
Thanks, no more information is needed, at least for now.
Just in my opinion it may not be an issue except exception itself.
Comment 22 familygw 2010-03-29 22:58:20 UTC
Hi poeple, I've discovered which this problem is visible when the table hasn't a entity key in his model design.

Can you put your feedback about this issue?

PD: (in the 6.8 version, I can't duplicate this)
Comment 23 Sergey Petrov 2010-03-30 06:48:29 UTC
yes, forget to ask to try some latest netbeans as the issue have no sense if it's reproducible in 6.5,6.7 only and may be also in 6.8 and is not reproducible in current 6.9 as it may be already fixed or default behavior is changed.
Comment 24 Sergey Petrov 2010-03-30 14:15:00 UTC
As I see the was changes in this code after 6.7, I'm not sure if the issue is valid even in term show message instead of exception.
Please try some later nb with "bad" driver also, best would be some daily 6.9 build, but 6.8 may be good too. It will update/produce new stacktrace also with better match to current code.