Changeset e35d2b99e56605777c70a121f90e24ed626abed4

Show
Ignore:
Timestamp:
08/04/07 23:57:10 (1 year ago)
Author:
Christopher Jung <bktheg@web.de>
git-committer:
Christopher Jung <bktheg@web.de> 1186264630 +0200
git-parent:

[b269fa1e13fc42660af2dcf293e2e415732e5cb2]

git-author:
Christopher Jung <bktheg@web.de> 1186264630 +0200
Message:

Akademie auf Hibernate umgestellt

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • db/tables/academy.sql

    rb195b35 re35d2b9  
    11CREATE TABLE `academy` ( 
    2   `id` int(11) NOT NULL auto_increment, 
    32  `col` int(11) NOT NULL default '0', 
    43  `train` tinyint(4) NOT NULL default '0', 
    54  `remain` tinyint(4) NOT NULL default '0', 
    65  `upgrade` varchar(10) NOT NULL default '', 
    7   PRIMARY KEY  (`id`), 
    8   KEY `col` (`col`) 
     6  PRIMARY KEY  (`col`) 
    97) ENGINE=InnoDB DEFAULT CHARSET=utf8;  
    108 
  • db/tables/buildings.sql

    ra6ba521 re35d2b9  
    3939INSERT INTO `buildings` (`id`, `name`, `picture`, `buildcosts`, `consumes`, `produces`, `arbeiter`, `ever`, `eprodu`, `bewohner`, `techreq`, `eps`, `perplanet`, `perowner`, `category`, `ucomplex`, `deakable`, `module`) VALUES (16, 'Titanveredler', 'data/buildings/titanv.png', '0,0,50,70,0,0,0,20,20,0,0,0,0,0,0,0,0,0,', '0,0,0,8,0,0,0,6,0,0,0,0,0,0,0,0,0,0,', '0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,', 30, 8, 0, 0, 3, 0, 0, 0, 2, 0, 1, 'net.driftingsouls.ds2.server.bases.DefaultBuilding'); 
    4040INSERT INTO `buildings` (`id`, `name`, `picture`, `buildcosts`, `consumes`, `produces`, `arbeiter`, `ever`, `eprodu`, `bewohner`, `techreq`, `eps`, `perplanet`, `perowner`, `category`, `ucomplex`, `deakable`, `module`) VALUES (17, 'Forschungszentrum', 'data/buildings/fz.png', '0,0,300,200,0,0,0,150,150,0,0,0,0,0,0,0,0,0,', '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,', '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,', 0, 0, 0, 0, 0, 0, 1, 0, 4, 0, 0, 'net.driftingsouls.ds2.server.bases.Forschungszentrum'); 
    41 INSERT INTO `buildings` (`id`, `name`, `picture`, `buildcosts`, `consumes`, `produces`, `arbeiter`, `ever`, `eprodu`, `bewohner`, `techreq`, `eps`, `perplanet`, `perowner`, `category`, `ucomplex`, `deakable`, `module`) VALUES (18, 'Flottenakademie', 'data/buildings/akademie.png', '0,0,200,100,0,0,50,50,50,0,0,0,0,0,0,0,0,0,', '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,', '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,', 0, 0, 0, 0, 21, 0, 1, 0, 4, 0, 0, 'net.driftingsouls.ds2.server.bases.Academy'); 
     41INSERT INTO `buildings` (`id`, `name`, `picture`, `buildcosts`, `consumes`, `produces`, `arbeiter`, `ever`, `eprodu`, `bewohner`, `techreq`, `eps`, `perplanet`, `perowner`, `category`, `ucomplex`, `deakable`, `module`) VALUES (18, 'Flottenakademie', 'data/buildings/akademie.png', '0,0,200,100,0,0,50,50,50,0,0,0,0,0,0,0,0,0,', '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,', '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,', 0, 0, 0, 0, 21, 0, 1, 0, 4, 0, 0, 'net.driftingsouls.ds2.server.bases.AcademyBuilding'); 
    4242INSERT INTO `buildings` (`id`, `name`, `picture`, `buildcosts`, `consumes`, `produces`, `arbeiter`, `ever`, `eprodu`, `bewohner`, `techreq`, `eps`, `perplanet`, `perowner`, `category`, `ucomplex`, `deakable`, `module`) VALUES (19, 'Adamatiumveredler', 'data/buildings/xentv.png', '0,0,80,60,0,0,30,30,40,0,0,0,0,0,0,0,0,0,', '0,0,0,4,0,0,3,2,1,0,0,0,0,0,0,0,0,0,', '0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,', 60, 14, 0, 0, 9, 0, 0, 0, 2, 0, 1, 'net.driftingsouls.ds2.server.bases.DefaultBuilding'); 
    4343INSERT INTO `buildings` (`id`, `name`, `picture`, `buildcosts`, `consumes`, `produces`, `arbeiter`, `ever`, `eprodu`, `bewohner`, `techreq`, `eps`, `perplanet`, `perowner`, `category`, `ucomplex`, `deakable`, `module`) VALUES (20, 'Unterirdische Farm', 'data/buildings/farm.png', '0,0,120,150,0,0,60,40,30,5,0,0,0,0,0,0,0,0,', '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,', '1400,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,', 80, 18, 0, 0, 25, 0, 0, 0, 1, 1, 1, 'net.driftingsouls.ds2.server.bases.DefaultBuilding'); 
  • db/updates.xml

    r89d279c re35d2b9  
    346346                        ADD `scheduled` TINYINT( 1 ) NOT NULL DEFAULT '0'; 
    347347        ]]></update> 
     348        <update type="data" datum="2007-08-04"><![CDATA[ 
     349                UPDATE buildings SET module='net.driftingsouls.ds2.server.bases.AcademyBuilding' WHERE module='net.driftingsouls.ds2.server.bases.Academy'; 
     350        ]]></update> 
     351        <update type="structure" datum="2007-08-04"><![CDATA[ 
     352                ALTER TABLE `academy` DROP `id`; 
     353                ALTER TABLE `academy` ADD PRIMARY KEY ( `col` ); 
     354                ALTER TABLE `academy` DROP INDEX `col`; 
     355        ]]></update> 
    348356</updates> 
  • src/net/driftingsouls/ds2/server/entities/Academy.java

    re3938f6 re35d2b9  
    2121import javax.persistence.Entity; 
    2222import javax.persistence.FetchType; 
    23 import javax.persistence.GeneratedValue; 
    2423import javax.persistence.Id; 
    25 import javax.persistence.JoinColumn
    26 import javax.persistence.ManyToOne
     24import javax.persistence.OneToOne
     25import javax.persistence.PrimaryKeyJoinColumn
    2726import javax.persistence.Table; 
    2827 
     
    3736@Table(name="academy") 
    3837public class Academy { 
    39         @Id @GeneratedValue 
    40         private int id
    41         @ManyToOne(fetch=FetchType.LAZY) 
    42         @JoinColumn(name="col") 
     38        @Id 
     39        private int col
     40        @OneToOne(fetch=FetchType.LAZY) 
     41        @PrimaryKeyJoinColumn 
    4342        private Base base; 
    4443        private int train; 
     
    5251        public Academy() { 
    5352                // EMPTY 
     53        } 
     54         
     55        /** 
     56         * Erstellt eine neue Akademie 
     57         * @param base Die Basis auf der die Akademie steht 
     58         */ 
     59        public Academy(Base base) { 
     60                this.col = base.getID(); 
     61                this.base = base; 
     62                this.upgrade = ""; 
    5463        } 
    5564 
     
    119128 
    120129        /** 
    121          * Gibt die ID der Akademie zurueck 
    122          * @return Die ID 
     130         * Gibt die ID der Basis zurueck, auf der sich die Akademie befindet 
     131         * @return Die ID der Basis 
    123132         */ 
    124         public int getId() { 
    125                 return id
     133        public int getBaseId() { 
     134                return col
    126135        } 
    127136} 
  • web/WEB-INF/cfg/hibernatemappings.xml

    rd230b2f re35d2b9  
    1717        <mapping class="net.driftingsouls.ds2.server.bases.Building" /> 
    1818        <mapping class="net.driftingsouls.ds2.server.bases.DefaultBuilding" /> 
    19         <mapping class="net.driftingsouls.ds2.server.bases.Academy" /> 
     19        <mapping class="net.driftingsouls.ds2.server.bases.AcademyBuilding" /> 
    2020        <mapping class="net.driftingsouls.ds2.server.bases.Forschungszentrum" /> 
    2121        <mapping class="net.driftingsouls.ds2.server.bases.Kommandozentrale" />