Skip to content
This repository was archived by the owner on Apr 5, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public Account createAccount(Person person) throws EmailAlreadyOnFileException {
try {
jdbcTemplate.update("insert into Member (firstName, lastName, email, password, gender, birthdate) values (?, ?, ?, ?, ?, ?)",
person.getFirstName(), person.getLastName(), person.getEmail(), passwordEncoder.encode(person.getPassword()), person.getGender().code(), person.getBirthdate().toString());
Long accountId = jdbcTemplate.queryForLong("call identity()");
Long accountId = jdbcTemplate.queryForLong("call identity()")+1;
return accountMapper.newAccount(accountId, person);
} catch (DuplicateKeyException e) {
throw new EmailAlreadyOnFileException(person.getEmail());
Expand Down Expand Up @@ -136,4 +136,4 @@ public Account accessAccount(String password, PasswordEncoder passwordEncoder) t
}

private static final String SELECT_PASSWORD_PROTECTED_ACCOUNT = "select id, firstName, lastName, email, password, username, gender, pictureSet from Member";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private Long insertAction(String type, DateTime performTime, Account account, Lo
Double latitude = location != null ? location.getLatitude() : null;
Double longitude = location != null ? location.getLongitude() : null;
jdbcTemplate.update("insert into MemberAction (actionType, performTime, latitude, longitude, member) values (?, ?, ?, ?, ?)", type, performTime.toDate(), latitude, longitude, account.getId());
return jdbcTemplate.queryForLong("call identity()");
return jdbcTemplate.queryForLong("call identity()")+1;
}

private String actionType(Class<? extends Action> actionClass) {
Expand All @@ -81,4 +81,4 @@ private String actionType(Class<? extends Action> actionClass) {
return actionPart == -1 ? shortName : shortName.substring(0, actionPart);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public JdbcBadgeRepository(JdbcTemplate jdbcTemplate) {
public AwardedBadge createAwardedBadge(String badge, Account account, Action action) {
DateTime awardTime = new DateTime(DateTimeZone.UTC);
jdbcTemplate.update("insert into AwardedBadge (badge, awardTime, member, memberAction) values (?, ?, ?, ?)", badge, awardTime.toDate(), account.getId(), action.getId());
Long id = jdbcTemplate.queryForLong("call identity()");
Long id = jdbcTemplate.queryForLong("call identity()")+1;
// TODO dont hardcode
String imageUrl = "http://images.greenhouse.springsource.org/activity/icon-default-badge.png";
return new AwardedBadge(id, badge, awardTime, imageUrl, account, action);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public String createApp(Long accountId, AppForm form) {
String encryptedApiKey = encryptor.encrypt(keyGenerator.generateKey());
String encryptedSecret = encryptor.encrypt(keyGenerator.generateKey());
jdbcTemplate.update(INSERT_APP, form.getName(), slug, form.getDescription(), form.getOrganization(), form.getWebsite(), encryptedApiKey, encryptedSecret, form.getCallbackUrl());
Long appId = jdbcTemplate.queryForLong("call identity()");
Long appId = jdbcTemplate.queryForLong("call identity()")+1;
jdbcTemplate.update(INSERT_APP_DEVELOPER, appId, accountId);
return slug;
}
Expand Down