Hi Van,
In Robertos create table script, which is same as in mifos schema the 
LOOKUP_ID column has an AUTO_INCREMENT attribute. 
This means that mysql will automatically increment the assigned column 
value by 1 and the column value does not need to be included in the insert 
statement.
So insert statement can be 

insert into lookup_value (entity_id, lookup_name) values (100, 'name_1')

instead of

insert into lookup_value (lookup_id, entity_id, lookup_name) values (1, 
100, 'name_1')

and for multiple inserts you can also write :

insert into lookup_value (entity_id, lookup_name) values (100, 'name_1'), 
(101, 'name_2'), (200, 'new_name_1')

Is there any reason why we explicitly specify the value for the primary 
key ( lookup_id) ?

Hope this helps.
Thanks and regards
*ravi







Roberto Musso/Ireland/Contr/[EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED]
07/03/2008 11:56
Please respond to
Developer <[email protected]>


To
Developer <[email protected]>
cc
"Developer" <[email protected]>, 
[EMAIL PROTECTED]
Subject
Re: [Mifos-developer] Database upgrades using Java






Hi Van,
indeed :
CREATE TABLE lookup_value (
  LOOKUP_ID INTEGER AUTO_INCREMENT NOT NULL,
  ENTITY_ID SMALLINT,
  LOOKUP_NAME VARCHAR(100),
  PRIMARY KEY(LOOKUP_ID),
  FOREIGN KEY(ENTITY_ID)
    REFERENCES LOOKUP_ENTITY(ENTITY_ID)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION
)

So I am a litlle bit confused: why the insert does not use the feature?

Best


 
             "Van 
             Mittal-Henkle" 
             <[EMAIL PROTECTED]                                          To 

             ndation.org>              "Developer" 
             Sent by:                  <[EMAIL PROTECTED] 

             mifos-developer-b         net> 
             [EMAIL PROTECTED]                                          cc 

             ceforge.net 
                                                                   Subject 

                                       [Mifos-developer] Database upgrades 

             03/06/2008 02:00          using Java 
             AM 
 
 
             Please respond to 
                 Developer 
             <mifos-developer@ 
             lists.sourceforge 
                   .net> 
 
 




Questions surrounding Java based database upgrades have come up a number
of times, so I have taken a stab at adding some initial documentation
about when to do a Java based upgrade rather than a SQL based upgrade
and what basic steps should be followed.

http://www.mifos.org/developers/technical-orientation/mifos-database-dev
elopment#how-to-properly-script

http://mifos.org/developers/wiki/HowToDoJavaBasedDatabaseUpgrades

Questions and suggestions for improvement are welcomed :-)

--Van

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Reply via email to