About Question enthuware.oce-jpad.v6.2.546 :
Moderator: admin
-
- Posts: 1
- Joined: Wed Oct 10, 2012 7:58 am
- Contact:
About Question enthuware.oce-jpad.v6.2.546 :
How can an abstract class have a No-arg constructor
-
- Site Admin
- Posts: 10384
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.546 :
An abstract class can certainly have a no-args constructor.
-Paul.
-Paul.
Last edited by admin on Mon Sep 16, 2013 4:33 pm, edited 1 time in total.
Reason: cleaned up uninformational text
Reason: cleaned up uninformational text
-
- Posts: 5
- Joined: Sat Aug 31, 2013 5:39 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.546 :
"Identify the correct statements about following code"
Answer is "It must have no-args constructor."
But I think answer must be "It is a valid @Entity class."
Because no-args constructor will be created by compiler.
Answer is "It must have no-args constructor."
But I think answer must be "It is a valid @Entity class."
Because no-args constructor will be created by compiler.
-
- Site Admin
- Posts: 10384
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.546 :
In the given class code, an explicit constructor is already present:unknownartist wrote:"Identify the correct statements about following code"
Answer is "It must have no-args constructor."
But I think answer must be "It is a valid @Entity class."
Because no-args constructor will be created by compiler.
Code: Select all
public Vehicle(String code){ mfgCode = code; }
HTH,
Paul.
-
- Posts: 17
- Joined: Sat Feb 28, 2015 2:26 am
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.546 :
By the way entity has public field:
and as per section "2.2 Persistent Fields and Properties" of the specification:public String mfgCode;
does anyone know why RI EclipseLink accepts public fields in entities and doesn't throw exceptions ?The instance variables of a class must be private, protected, or package visibility independent of whether field access or property access is used.
-
- Site Admin
- Posts: 10384
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.546 :
Yes, this is another reason why the entity is invalid.
Regarding why EclipseLink accepts public fields, I think that is just an oversight. There are several instances where RI or other persistence providers does not follow the specification to the dot. I think we have noted such cases in some of our questions as well.
HTH,
Paul.
Regarding why EclipseLink accepts public fields, I think that is just an oversight. There are several instances where RI or other persistence providers does not follow the specification to the dot. I think we have noted such cases in some of our questions as well.
HTH,
Paul.
Who is online
Users browsing this forum: No registered users and 7 guests