User Name | Access Key Id | Secret Access Key |
---|---|---|
curso5 | AKIAJV2OXYVX6MVRU6XA | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
curso4 | AKIAIN6FMANDLENBRD6A | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
curso3 | AKIAJKPS4Y6YRW4CDRLA | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
curso2 | AKIAJ2QGVRB5IGVFBQKQ | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
curso1 | AKIAJTAMNVGFK3L6Z43Q | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select regexp_replace('my text with aditional spaces', '\s{1}+', ' ') from dual; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Simple model validation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans xmlns="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:context="http://www.springframework.org/schema/context" | |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd | |
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"> | |
<bean id="founder" class="com.socialfoundry.model.Founder"/> | |
<bean id="project" class="com.socialfoundry.model.Project"/> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<Contact> findAll() { | |
String sql = "select id, first_name, last_name, birth_date from contact"; | |
return jdbcTemplate.query(sql, new ContactMapper()); | |
} | |
public List<Contact> findAllWithDetail() { | |
String sql = "select c.id, c.first_name, c.last_name, c.birth_date" + | |
", t.id as contact_tel_id, t.tel_type, t.tel_number from contact c " + | |
"left join contact_tel_detail t on c.id = t.contact_id"; | |
return jdbcTemplate.query(sql, new ContactWithDetailExtractor()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final class ContactWithDetailExtractor implements ResultSetExtractor<List<Contact>> { | |
public List<Contact> extractData(ResultSet rs) throws SQLException, | |
DataAccessException { | |
Map<Long, Contact> map = new HashMap<Long, Contact>(); | |
Contact contact = null; | |
while (rs.next()) { | |
Long id = rs.getLong("id"); | |
contact = map.get(id); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans xmlns="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:context="http://www.springframework.org/schema/context" | |
xmlns:jdbc="http://www.springframework.org/schema/jdbc" | |
xmlns:jee="http://www.springframework.org/schema/jee" | |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd | |
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd | |
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd | |
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELIMITER // | |
CREATE FUNCTION getFirstNameById(in_id INT) | |
RETURNS VARCHAR(60) | |
BEGIN | |
RETURN (SELECT first_name FROM CONTACT WHERE id = in_id); | |
END // | |
DELIMITER ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<Contact> findAll() { | |
return sessionFactory.getCurrentSession().createQuery("from Contact c").list(); | |
} | |
public List<Contact> findAllWithDetail() { | |
return sessionFactory.getCurrentSession().getNamedQuery("Contact.findAllWithDetail").list(); | |
} | |
public Contact findById(Long id) { | |
return (Contact) sessionFactory.getCurrentSession(). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company.hibernate.dao; | |
import java.util.List; | |
import javax.annotation.Resource; | |
import org.apache.commons.logging.Log; | |
import org.apache.commons.logging.LogFactory; | |
import org.hibernate.SessionFactory; | |
import org.springframework.stereotype.Repository; |
OlderNewer