table and column names changed to Upper

exception
parent 8a50747ffd
commit 6883bbdf37

@ -38,7 +38,7 @@ public class MailDAOImpl implements MailDAO {
PreparedStatement stmt;
int generatedId;
Connection conn = this.getConnection();
stmt = conn.prepareStatement("INSERT INTO email (EMAIL_ADDRESS, MSG_TEMPLATE, PRIORITY, ATTACHMENT, PARAMETERS, TIME, FILENAME, EXPIRY_AT) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", PreparedStatement.RETURN_GENERATED_KEYS);
stmt = conn.prepareStatement("INSERT INTO EMAIL (EMAIL_ADDRESS, MSG_TEMPLATE, PRIORITY, ATTACHMENT, PARAMETERS, TIME, FILENAME, EXPIRY_AT) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", PreparedStatement.RETURN_GENERATED_KEYS);
Timestamp current_time = new Timestamp(System.currentTimeMillis());
String parametersJson = new ObjectMapper().writeValueAsString(mailModel.getParameters());
stmt.setString(1, mailModel.getEmailAddress());
@ -70,7 +70,7 @@ public class MailDAOImpl implements MailDAO {
@Override
public List<MailModel> getUnsentMessages() {
String sql = "SELECT * FROM email WHERE email_id NOT IN (SELECT email_id FROM sentEmail)";
String sql = "SELECT * FROM EMAIL WHERE EMAIL_ID NOT IN (SELECT EMAIL_ID FROM SENTEMAIL)";
List<MailModel> unsentMails = new ArrayList<>();
@ -79,9 +79,9 @@ public class MailDAOImpl implements MailDAO {
ResultSet rs = statement.executeQuery()) {
while (rs.next()) {
MailModel mailModel = new MailModel();
mailModel.setEmailId(rs.getInt("email_id"));
mailModel.setPriority(rs.getInt("priority"));
mailModel.setExpiry_at(rs.getDate("expiry_at"));
mailModel.setEmailId(rs.getInt("EMAIL_ID"));
mailModel.setPriority(rs.getInt("PRIORITY"));
mailModel.setExpiry_at(rs.getDate("EXPIRY_AT"));
unsentMails.add(mailModel);
}
} catch (SQLException e) {
@ -94,7 +94,7 @@ public class MailDAOImpl implements MailDAO {
@Override
public MailModel getMailDetails(Integer mail_id) {
String sql = "SELECT * FROM email WHERE email_id = ?";
String sql = "SELECT * FROM EMAIL WHERE EMAIL_ID = ?";
MailModel mailModel = new MailModel();
try {
@ -103,19 +103,19 @@ public class MailDAOImpl implements MailDAO {
stmt.setInt(1, mail_id);
try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) {
mailModel.setEmailId(rs.getInt("email_id"));
mailModel.setEmailAddress(rs.getString("email_address"));
mailModel.setMsgTemplate(rs.getString("msg_template"));
mailModel.setPriority(rs.getInt("priority"));
mailModel.setEmailId(rs.getInt("EMAIL_ID"));
mailModel.setEmailAddress(rs.getString("EMAIL_ADDRESS"));
mailModel.setMsgTemplate(rs.getString("MSG_TEMPLATE"));
mailModel.setPriority(rs.getInt("PRIORITY"));
String jsonData = rs.getString("parameters");
String jsonData = rs.getString("PARAMETERS");
List<MailModel.Parameter> parameters = parseJsonParameters(jsonData);
mailModel.setParameters(parameters);
String filename = rs.getString("filename");
String filename = rs.getString("FILENAME");
mailModel.setFilename(filename);
Blob blob = rs.getBlob("attachment");
Blob blob = rs.getBlob("ATTACHMENT");
File file = convertBlobToFile(blob, filename);
mailModel.setFile(file);
}
@ -161,7 +161,7 @@ public class MailDAOImpl implements MailDAO {
try {
PreparedStatement stmt;
Connection connection = this.getConnection();
stmt = connection.prepareStatement("INSERT INTO sentEmail (email_id,sent_time) VALUE (?,?)");
stmt = connection.prepareStatement("INSERT INTO SENTEMAIL (EMAIL_ID,SENT_TIME) VALUE (?,?)");
stmt.setInt(1, mail_id);
stmt.setDate(2, Date.valueOf(LocalDate.now()));
stmt.execute();

@ -2,9 +2,9 @@ spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username=chandrasegar@entgra.io
spring.mail.password=kfgt idre luvt ismk
spring.datasource.url=jdbc:mysql://${MYSQL_HOST:localhost}:3306/email_sending
spring.datasource.username=entgra
spring.datasource.password=entgra123
spring.datasource.url=jdbc:mysql://localhost:3306/email_sending
spring.datasource.username=root
spring.datasource.password=StrongPassword123!
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

Loading…
Cancel
Save