我有以下数据结构:
{
"proccess1": {
"error": "error1 description",
"nextRetryAt": "2018-02-22T07:39:00.325Z",
"attemptsMade": 148,
"firstFailedAt": "2018-02-16T06:40:41.327Z"
},
"proccess2": {
"error": "error2 description",
"nextRetryAt": "2019-03-16T06:41:01.566Z",
"attemptsMade": 77,
"firstFailedAt": "2016-03-15T04:35:12.248Z"
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是如何构建查询
select *
from data
where data->[0]->>'nextRetryAt' = 'my passed value'
Run Code Online (Sandbox Code Playgroud)
我不知道键proccess1和proccess2. 他们可能有任何价值。
<listener>
<listener-class>config</listener-class>
</listener>
<servlet>
<servlet-name>ProcessReg</servlet-name>
<servlet-class>ProcessReg</servlet-class>
<init-param>
<param-name>text</param-name>
<param-value>HelloWorld1</param-value>
</init-param>
Run Code Online (Sandbox Code Playgroud)
public class config implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent event) {
ServletContext servletContext = event.getServletContext();
String text1 = servletContext.getInitParameter("text");
Run Code Online (Sandbox Code Playgroud)
在方法中 contextInitialized(ServletContextEvent event),如果有两个servlet,例如,让我们说第二个servlet的名称是,Servlet2并且它可以说已经init - param调用text了值HelloWorld2.
怎么listener 知道服用ProcessRegservlet?
如何param从Servlet2?
我正在开发javaSE中的小应用程序,只是为了让我的技能更好.所以我有业务服务(BS进一步),其中一些方法就像registerUser(用户用户),addAmount(长accountId).BS使用dao.假设从WS或其他接口元素调用BS.我有以下DAO:
public interface UserDao {
User getUserByUsername(String username);
void saveUser(User user);
}
public interface AccountDao {
void saveAccount(Account account);
Account getAccountByUserId(Long userId);
}
Run Code Online (Sandbox Code Playgroud)
我的BS看起来像
public class FastAccountServiceImpl implements FastAccountService{
private UserDao userDao;
private AccountDao accountDao;
public void registerUser(User user, Account account) throws Exception {
if (user.getUsername() == null || user.getUsername().isEmpty()) {
throw new Exception("all params are mandatory");
}
if (userDao.getUserByUsername(user.getUsername()) != null) {
throw new Exception("This user exists");
}
userDao.saveUser(user);
accountDao.saveAccount(account);
}
public void withdrawAmount(Double amount, Long userId) throws Exception …Run Code Online (Sandbox Code Playgroud)