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 208750

Summary: PetCatalog - case sensitive problem with sql
Product: javaee Reporter: Vladimir Riha <vriha>
Component: SamplesAssignee: Martin Janicek <mjanicek>
Status: VERIFIED FIXED    
Severity: normal CC: sj-nb, vriha
Priority: P3    
Version: 7.1.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Vladimir Riha 2012-02-22 13:18:26 UTC
On my system (Ubuntu 11.04 64b), names of MySQL tables/columns are case sensitive. When you look into catalog.sql in PetCatalog project you can see all names in lower cases. However in (for example) model.Item.java there are annotations like

@Entity
@Table(name = "ITEM")
@NamedQueries({@NamedQuery(name = "Item.findAll", query = "SELECT i FROM Item i")

So the sql query contains "Item" but MySQL table is called "item" (not sure about the @TABLE annotation either). And it causes exceptions. I'm almost sure that this doesn't make any troubles on Windows (I'll check tomorrow but I don't remember having to rename tables/columns).


Product Version: NetBeans IDE 7.1.1 RC1 (Build 201202141941)
Java: 1.7.0_03; Java HotSpot(TM) Client VM 22.1-b02
System: Linux version 2.6.38-13-generic running on i386; UTF-8; en_US (nb)
Comment 1 Sergey Petrov 2012-02-22 20:39:35 UTC
it's not samples, persistence support do not support case sensitive behavior, not sure it should be classified as a defect. As even jpa itself usually maps default mappings(without annotations or missed "name") to upper case.
Comment 2 Sergey Petrov 2012-02-22 20:41:30 UTC

*** This bug has been marked as a duplicate of bug 192314 ***
Comment 3 Sergey Petrov 2012-02-22 20:43:01 UTC
as I remeber it's not windows/linux bahavior but is some options for mysql to be case sensitive/insensitive
Comment 4 Vladimir Riha 2012-02-22 21:40:46 UTC
Just mirroring comment:


I'm not sure that this bug is a duplicate of  bug #192314. This bug is about ability to run given sample project.

Wouldn't be useful to edit the sql dump in PetCatalog so it will contain the
exact same lower/upper cases as annotation in java source files? As a result if
one will run on case insensitive DB then it won't matter and if one will run it
on case sensitive it will fits and also possible to run.

I'm not reassigning back since I don't know if the proposed workaround will actually work.
Comment 5 Sergey Petrov 2012-02-22 22:04:13 UTC
from 192314, there is "wrong" annotation^
@Table(name = "IDEAS")
and good one:
@Table(name = "\"IDEAS\"")

it looks like it's hard to make universal script to fit both cases sensitive and insensitive. yet from some link as 192314 is old enough and there was issues with eclipselink it may have sense to reverify if it's reproducible.
Comment 6 Sergey Petrov 2012-05-12 09:25:04 UTC
I'm not sure I can fix it in 7.2, as for sample specific question instead of general "case sensitive" issue, it may be said it's required to be run with case insensitive db configuration.
Comment 7 Sergey Petrov 2012-11-22 13:36:01 UTC
>So the sql query contains "Item" but MySQL table is called "item" 
It's not sql, it's jpql query and contain entity class name.
It's not an issue.

Wouldn't be useful to edit the sql dump in PetCatalog so it will contain the
exact same lower/upper cases as annotation in java source files?

In my opinion it may be good solution, if "sql dump" will create all tables with upper case (I see all is created with lower case currently 'CREATE TABLE item')
And it may be best solution with current nb limitation on case sensitive tables support.

Push to samples for evaluation, if it's not very good solution,  please push back and need to be fixed as part of case sensitive support in jpq support.
Comment 8 Martin Janicek 2012-11-22 15:19:28 UTC
Sure I can do that as a temporary solution
Comment 9 Martin Janicek 2012-12-03 14:00:58 UTC
Ok, I've changed the sql script in web-main #7c9dea96b1b5 (now it's creating upper case tables)
As far as I understand that's the only thing that could be done on samples side, right?

If there is anything else I should do, please reopen the issue.
Comment 10 Quality Engineering 2012-12-07 02:41:16 UTC
Integrated into 'main-golden', will be available in build *201212070001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/7c9dea96b1b5
User: Martin Janicek <mjanicek@netbeans.org>
Log: #208750 - PetCatalog - case sensitive problem with sql
Comment 11 Vladimir Riha 2013-01-29 11:40:35 UTC
v.

Product Version: NetBeans IDE 7.3 RC1 (Build 201301282200)
Java: 1.7.0_11; Java HotSpot(TM) Client VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_11-b21
System: Linux version 3.2.0-35-generic-pae running on i386; UTF-8; en_US (nb)