Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.JdbcTemplate.execute()


    public void init() {
        super.init(dataSource);
        JdbcTemplate template = new JdbcTemplate(dataSource);

        // Schema: Petclinic
        template
                .execute("CREATE TABLE vets (id INT NOT NULL IDENTITY PRIMARY KEY, first_name VARCHAR(30), last_name VARCHAR(30))");
        template.execute("CREATE TABLE specialties (id INT NOT NULL IDENTITY PRIMARY KEY, name VARCHAR(80))");

        template.execute("CREATE TABLE vet_specialties (vet_id INT NOT NULL, specialty_id INT NOT NULL)");
        template
View Full Code Here


        JdbcTemplate template = new JdbcTemplate(dataSource);

        // Schema: Petclinic
        template
                .execute("CREATE TABLE vets (id INT NOT NULL IDENTITY PRIMARY KEY, first_name VARCHAR(30), last_name VARCHAR(30))");
        template.execute("CREATE TABLE specialties (id INT NOT NULL IDENTITY PRIMARY KEY, name VARCHAR(80))");

        template.execute("CREATE TABLE vet_specialties (vet_id INT NOT NULL, specialty_id INT NOT NULL)");
        template
                .execute("alter table vet_specialties add constraint fk_vet_specialties_vets foreign key (vet_id) references vets(id)");
        template
View Full Code Here

        // Schema: Petclinic
        template
                .execute("CREATE TABLE vets (id INT NOT NULL IDENTITY PRIMARY KEY, first_name VARCHAR(30), last_name VARCHAR(30))");
        template.execute("CREATE TABLE specialties (id INT NOT NULL IDENTITY PRIMARY KEY, name VARCHAR(80))");

        template.execute("CREATE TABLE vet_specialties (vet_id INT NOT NULL, specialty_id INT NOT NULL)");
        template
                .execute("alter table vet_specialties add constraint fk_vet_specialties_vets foreign key (vet_id) references vets(id)");
        template
                .execute("alter table vet_specialties add constraint fk_vet_specialties_specialties foreign key (specialty_id) references specialties(id)");
View Full Code Here

        template
                .execute("CREATE TABLE vets (id INT NOT NULL IDENTITY PRIMARY KEY, first_name VARCHAR(30), last_name VARCHAR(30))");
        template.execute("CREATE TABLE specialties (id INT NOT NULL IDENTITY PRIMARY KEY, name VARCHAR(80))");

        template.execute("CREATE TABLE vet_specialties (vet_id INT NOT NULL, specialty_id INT NOT NULL)");
        template
                .execute("alter table vet_specialties add constraint fk_vet_specialties_vets foreign key (vet_id) references vets(id)");
        template
                .execute("alter table vet_specialties add constraint fk_vet_specialties_specialties foreign key (specialty_id) references specialties(id)");

        template.execute("CREATE TABLE types (id INT NOT NULL IDENTITY PRIMARY KEY, name VARCHAR(80))");
View Full Code Here

        template.execute("CREATE TABLE specialties (id INT NOT NULL IDENTITY PRIMARY KEY, name VARCHAR(80))");

        template.execute("CREATE TABLE vet_specialties (vet_id INT NOT NULL, specialty_id INT NOT NULL)");
        template
                .execute("alter table vet_specialties add constraint fk_vet_specialties_vets foreign key (vet_id) references vets(id)");
        template
                .execute("alter table vet_specialties add constraint fk_vet_specialties_specialties foreign key (specialty_id) references specialties(id)");

        template.execute("CREATE TABLE types (id INT NOT NULL IDENTITY PRIMARY KEY, name VARCHAR(80))");
        template
                .execute("CREATE TABLE owners (id INT NOT NULL IDENTITY PRIMARY KEY, first_name VARCHAR(30), last_name VARCHAR(30), address VARCHAR(255), city VARCHAR(80), telephone VARCHAR(20))");
View Full Code Here

        template
                .execute("alter table vet_specialties add constraint fk_vet_specialties_vets foreign key (vet_id) references vets(id)");
        template
                .execute("alter table vet_specialties add constraint fk_vet_specialties_specialties foreign key (specialty_id) references specialties(id)");

        template.execute("CREATE TABLE types (id INT NOT NULL IDENTITY PRIMARY KEY, name VARCHAR(80))");
        template
                .execute("CREATE TABLE owners (id INT NOT NULL IDENTITY PRIMARY KEY, first_name VARCHAR(30), last_name VARCHAR(30), address VARCHAR(255), city VARCHAR(80), telephone VARCHAR(20))");

        template
                .execute("CREATE TABLE pets (id INT NOT NULL IDENTITY PRIMARY KEY, name VARCHAR(30), birth_date DATE, type_id INT NOT NULL, owner_id INT NOT NULL)");
View Full Code Here

                .execute("alter table vet_specialties add constraint fk_vet_specialties_vets foreign key (vet_id) references vets(id)");
        template
                .execute("alter table vet_specialties add constraint fk_vet_specialties_specialties foreign key (specialty_id) references specialties(id)");

        template.execute("CREATE TABLE types (id INT NOT NULL IDENTITY PRIMARY KEY, name VARCHAR(80))");
        template
                .execute("CREATE TABLE owners (id INT NOT NULL IDENTITY PRIMARY KEY, first_name VARCHAR(30), last_name VARCHAR(30), address VARCHAR(255), city VARCHAR(80), telephone VARCHAR(20))");

        template
                .execute("CREATE TABLE pets (id INT NOT NULL IDENTITY PRIMARY KEY, name VARCHAR(30), birth_date DATE, type_id INT NOT NULL, owner_id INT NOT NULL)");
        template.execute("alter table pets add constraint fk_pets_owners foreign key (owner_id) references owners(id)");
View Full Code Here

        template.execute("CREATE TABLE types (id INT NOT NULL IDENTITY PRIMARY KEY, name VARCHAR(80))");
        template
                .execute("CREATE TABLE owners (id INT NOT NULL IDENTITY PRIMARY KEY, first_name VARCHAR(30), last_name VARCHAR(30), address VARCHAR(255), city VARCHAR(80), telephone VARCHAR(20))");

        template
                .execute("CREATE TABLE pets (id INT NOT NULL IDENTITY PRIMARY KEY, name VARCHAR(30), birth_date DATE, type_id INT NOT NULL, owner_id INT NOT NULL)");
        template.execute("alter table pets add constraint fk_pets_owners foreign key (owner_id) references owners(id)");
        template.execute("alter table pets add constraint fk_pets_types foreign key (type_id) references types(id)");

        template
View Full Code Here

        template
                .execute("CREATE TABLE owners (id INT NOT NULL IDENTITY PRIMARY KEY, first_name VARCHAR(30), last_name VARCHAR(30), address VARCHAR(255), city VARCHAR(80), telephone VARCHAR(20))");

        template
                .execute("CREATE TABLE pets (id INT NOT NULL IDENTITY PRIMARY KEY, name VARCHAR(30), birth_date DATE, type_id INT NOT NULL, owner_id INT NOT NULL)");
        template.execute("alter table pets add constraint fk_pets_owners foreign key (owner_id) references owners(id)");
        template.execute("alter table pets add constraint fk_pets_types foreign key (type_id) references types(id)");

        template
                .execute("CREATE TABLE visits (id INT NOT NULL IDENTITY PRIMARY KEY, pet_id INT NOT NULL, visit_date DATE, description VARCHAR(255))");
        template.execute("alter table visits add constraint fk_visits_pets foreign key (pet_id) references pets(id)");
View Full Code Here

                .execute("CREATE TABLE owners (id INT NOT NULL IDENTITY PRIMARY KEY, first_name VARCHAR(30), last_name VARCHAR(30), address VARCHAR(255), city VARCHAR(80), telephone VARCHAR(20))");

        template
                .execute("CREATE TABLE pets (id INT NOT NULL IDENTITY PRIMARY KEY, name VARCHAR(30), birth_date DATE, type_id INT NOT NULL, owner_id INT NOT NULL)");
        template.execute("alter table pets add constraint fk_pets_owners foreign key (owner_id) references owners(id)");
        template.execute("alter table pets add constraint fk_pets_types foreign key (type_id) references types(id)");

        template
                .execute("CREATE TABLE visits (id INT NOT NULL IDENTITY PRIMARY KEY, pet_id INT NOT NULL, visit_date DATE, description VARCHAR(255))");
        template.execute("alter table visits add constraint fk_visits_pets foreign key (pet_id) references pets(id)");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.