Java generics incompatible types (no instance(s) of type variable(s) T exist)

ArrayList is an implementation of List interface. So all ArrayList instances are List instances but all List instances are not necessarily ArrayList. So when you call this method : public static <T> List<T> inRange(List<T> list, int index, int range) { you cannot assign its result to an ArrayList as you are doing : ArrayList<View> inRange … Read more

what’s the difference between service layer and domain model layer

The Domain Model contains information and functionality related to what it means to be a User. It should map conceptually onto something that exists physically in the real world or a clearly defined concept in the problem space. The Service contains information and functionality related to performing atomic units of work. It should map conceptually … Read more

Spring JPA Repository dynamic query [duplicate]

Per JB Nizet and the spring-data documentation, you should use a custom interface + repository implementation. Create an interface with the method: public interface MyEntityRepositoryCustom { List<User> findByFilterText(Set<String> words); } Create an implementation: @Repository public class MyEntityRepositoryImpl implements MyEntityRepositoryCustom { @PersistenceContext private EntityManager entityManager; public List<User> findByFilterText(Set<String> words) { // implementation below } } Extend … Read more

How can I convert an Icon to an Image

Just found a code snippet which might help if you want to wrap those misbehaving LAF provided icons more often: /** * Some ui-icons misbehave in that they unconditionally class-cast to the * component type they are mostly painted on. Consequently they blow up if * we are trying to paint them anywhere else (f.i. … Read more

In log4j 1.2 to log4j 2 migration, what to do with the DailyRollingFileAppender class?

You are looking for the RollingFile appender <RollingFile name=”DAILY_LOG” fileName=”log/daily.log” filePattern=”log/%d{ddMMyyyy}_daily.log” > <PatternLayout pattern=”%d [%7r] %5p – %c – %m%n”/> <Policies> <TimeBasedTriggeringPolicy interval=”1″/> </Policies> </RollingFile> The previous sample rolls over by day, the interval being 1 unit which is determined by the smallest unit of the date lookup in the file pattern. In other words … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)