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 208420

Summary: There is no ID defined for this entity hierarchy.
Product: javaee Reporter: gualtiero65
Component: PersistenceAssignee: Sergey Petrov <sj-nb>
Status: REOPENED ---    
Severity: normal CC: mpetras
Priority: P3    
Version: 7.1   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Attachments: Java class wich defined an entity

Description gualtiero65 2012-02-14 19:49:34 UTC
The "There is no ID defined for this entity hierarchy." error is reported even if the ID is defined in the entity.


Product Version = NetBeans IDE 7.1 (Build 201112071828)
Operating System = Linux version 2.6.32-220.4.1.el6.x86_64 running on amd64
Java; VM; Vendor = 1.6.0_30
Runtime = Java HotSpot(TM) 64-Bit Server VM 20.5-b03
Comment 1 gualtiero65 2012-02-14 19:50:50 UTC
Created attachment 115722 [details]
Java class wich defined an entity
Comment 2 Martin Fousek 2012-02-20 08:28:54 UTC
I'm not able to reproduce in latest build. Anyway assigning to the proper category...
Comment 3 gualtiero65 2012-02-20 12:32:46 UTC
Hi,

I've found that the issue is connected to @Transient fields.

If I comment out @Transient fields/getters the problem disappears.

Gualtiero
Comment 4 Martin Fousek 2012-02-20 14:09:58 UTC
You mean that you had your ID annotated as @Transient? In that case would be the hint ok since @Transient entity fields aren't stored into database or not?

Anyway, Sergey will be able to provide more information for sure.
Comment 5 gualtiero65 2012-02-21 08:26:25 UTC
No.
ID is not Transient.

 @Id
    @GeneratedValue(generator = "system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    protected String id;


In the same entity/class I have getters like this

@Transient
    public String getNomeCompleto() {
        return String.format("%s %s", getCognome() == null ? "" : getCognome(), getNome() == null ? "" : getNome());
    }


If I comment out these getters the "There is no ID defined for this entity hierarchy." error disappears.
Comment 6 Sergey Petrov 2012-03-23 13:53:05 UTC
it seems to be valid issue, but also looks like there is entity declaration issue with mixed access type, id have fields access type but transient is applied to property, I need to double check but it may not be good according to specification also if no explicit default access type is selected and modified by @Access later, but in this case there should be a warning regarding access type mixing not regarding @Id in my opinion(not supported yet)
Comment 7 Sergey Petrov 2012-03-23 13:58:36 UTC
ok, just tried to mix access type and got both warnings(inside one) - regarding access type and missed id, first one regarding access type and it's ok as it do not allow to determine if there is id properly we suppose there is no id. 
do you see both warnings? the issue may be invalid then. Please reopen if you see only one or I miss something regarding mixed access.
Comment 8 Marian Petras 2015-05-05 14:43:58 UTC
I confirm this happens on entities with mixed access (field + property).

I have properly configured mixed access on three entities and the misleading error hint appears just on these entity classes.

In all three entities:
 - field access is the default access type (the entity class is annotatited with @Access(AccessType.FIELD))
 - the ID column (@Id) is using the default access type, i.e. field access type
 - there are 1 to 3 columns with the property access type (the getter is annotated with @Access(AccessType.PROPERTY))
 - fields corresponding to these columns are annotated with @Transient (as required by JPA)
Comment 9 Martin Balin 2016-07-07 08:54:19 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
Comment 10 eldermoraes 2016-11-24 02:42:30 UTC
(In reply to Martin Balin from comment #9)
> This old bug may not be relevant anymore. If you can still reproduce it in
> 8.2 development builds please reopen this issue.
> 
> Thanks for your cooperation,
> NetBeans IDE 8.2 Release Boss

Just tried it on Netbeans IDE 8.2 and the issue remains the same. Got some entities with @Transient properties (not ID) and got the same error.