• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

query on orm.xml and bean compilation

 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Please refer O�Reilly�s book page 98, Section 6.1.2. The last sentence of that section is really not clear to me. Similarly if the ultimately the property is to be persisted in the database, why do we differentiate its access by the database by the access type. In other words the PROPERTY or METHOD is ultimately referring to the property what difference exists between these two ways seeing from the point of view of table? Can any one please explain this concept single column name and a bean property?

Also I am still trying to just plainly compile the first bean class on the command prompt. But when I do so I get error � package persistence does not exist and even errors for the annotations. What JAR contains all these stuff, the persistence and the ejb package? I do see the j2ee and the javaee jar files in the the Sun�s SDK that I downloaded. Like for example the servlet classes are in the servlet.jar where as the jsp stuff can be found in jsp-api.jar. Which are the jars that hold the persistence and ejb stuff?
 
Marimuthu Madasamy
Ranch Hand
Posts: 72
Java Monad Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In other words the PROPERTY or METHOD is ultimately referring to the property what difference exists between these two ways seeing from the point of view of table?

First of all, the access type should be either PROPERTY or FIELD (not METHOD). One difference between them is that in PROPERTY access, the accessor methods can contain business logic which will be executed by the persistence provider runtime. But you should not depend on the order of the invocation of these accessor methods.

I am using JBoss. So other ranchers may help you on your bean compilation query with Sun's SDK.
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, the access type should be either METHOD or FIELD (not PROPERTY).


It was a typo

One difference between them is that in METHOD access, the accessor methods can contain business logic which will be executed by the persistence provider runtime. But you should not depend on the order of the invocation of these accessor methods.


So when I use METHOD, the accessor methods will be used to get/set the values of the entity's properties. And as said by Mutthu, these can contain business logic -





And when you use FIELD, the value of the entity's property is fetched directly, no method access happens. Am I right?
[ February 06, 2008: Message edited by: Niranjan Deshpande ]
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Again there is confusion. The access type must be either FIELD or PROPERTY.
FIELD means annotations are applied on the instance variables of the class. PROPERTY means annotations are applied on getXXX methods of the property.

Thanks
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Narendra,

I have edited the post now, please do comment on it now
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Narendra..Am I correct now?
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, For more details in what are properties refer some basic documentation on JavaBean.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic