mercredi 6 mai 2015

ibatis resultMap properties vs java pojo variables

I need some clarification on the following as I just took over an old j2Ee project and am studying the codes, plus I had no experience in ibatis. Sorry for the noob question but I searched for 2 days with no answers.

Example: I have a pojo class :

public class Document
{
          private int _id;
          private string _title;
          ..........
}

DB Table :

CREATE TABLE [Documents] (
       [Document_ID] [int] NOT NULL ,
       [Document_Title] [varchar] (32) NULL ,
)

Mapping :

<resultMap id="document" class="Document">
     <result property="id" column="Document_ID"/>
     <result property="title" column="Document_Title"/>
</resultMap>

Question :

I noticed that in the declaration of the id and title variables(in java),there was a underscore in front(I have instances where the underscore was behind, eg.title) but in the resultmap, the underscore is not there. I'm curiuos how it's Mapping is done since the 2 doesn't match exactly.

Thanks for your guidance.

Aucun commentaire:

Enregistrer un commentaire