One of the limitation of PreparedStatement is that we can’t use it directly with IN clause statements. Some of the alternative approaches to use PreparedStatement with IN clause are:
Execute Single Queries – very slow performance and not recommended
Using Stored Procedure – Database specific and hence not suitable for multiple database applications.
Creating PreparedStatement Query dynamically – Good approach but looses the benefit of cached PreparedStatement.
Using NULL in PreparedStatement Query – A good approach when you know the maximum number of variables inputs, can be extended to allow unlimited parameters by executing in parts.