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 235543 - Java Persistence: DB datatype boolean => entity datatype Serializable
Summary: Java Persistence: DB datatype boolean => entity datatype Serializable
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 7.3.1
Hardware: PC Windows 8
: P2 normal (vote)
Assignee: Sergey Petrov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-05 07:50 UTC by emmi83
Modified: 2013-11-29 02:55 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description emmi83 2013-09-05 07:50:43 UTC
Hi Support,

I guess I found an error in the entity class generation of netbeans 7.3.1.

The DB data type boolean will be mapped to Serializable in the entity class instead of Boolean.

This is reproducable with the onboard Java DB (embedded) or even with H2 v1.3.173.

Workaround could be to change the data type of the relevant entity properties manually, but this is not really sufficient because I build my model classes by inheriting from the entities and overwriting the properties. So I have the possibility to re-generate the entities from DB everytime I need to change the DB structure without overwriting my changes/enhancements in the entity!

Cheers,
Daniel
Comment 1 Sergey Petrov 2013-09-05 12:08:48 UTC
can you provide sql for your table or db schema?
Comment 2 emmi83 2013-09-08 18:14:09 UTC
Hi Sergey,

This is an example of my create table Statement:

create table "APP".PROJECT
(
	ID INTEGER not null primary key,
	TITLE VARCHAR(100) not null,
	DEFAULT_RATE DECIMAL(6,2) not null,
	START_DATE DATE,
	END_DATE DATE,
	CLOSED BOOLEAN default false not null,   
	CUSTOMER_ID INTEGER not null
)

Column "CLOSED" is type boolean and gets generated as Serializable instead of Boolean (or boolean if not null).

This is reproducable by Java DB and H2.

Hope it helps.

Best Regards,
Daniel
Comment 3 emmi83 2013-09-08 18:15:31 UTC
I found out, that this issue happens only for embedded JavaDB or H2!
Comment 4 Sergey Petrov 2013-11-28 16:08:31 UTC
Can't evaluate right now as have
"Error code -1, SQL state XCL47: To use 'BOOLEAN' need to update database version 10.5 to 10.7 or newer.
Line 1, column 1

Execution finished after 0 s, 1 error(s) occurred.
"
but I have derby version 10.8.2.2
Comment 5 Sergey Petrov 2013-11-28 16:13:15 UTC
ok, now I can reproduce the issue.
I suppose related code was created at time boolean wasn't supported by derby and all unsupported types are mapped as Serializable.
Comment 6 Sergey Petrov 2013-11-28 17:20:34 UTC
http://hg.netbeans.org/web-main/rev/31181420f826
Comment 7 Quality Engineering 2013-11-29 02:55:04 UTC
Integrated into 'main-silver', will be available in build *201311290002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/31181420f826
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: #235543 add BOOLEAN as recognized type