What’s better for creating distinct data structures: HashSet or Linq’s Distinct()?

Anthony Pegram has said it the best. Use the right tool for the job. I say this because a Distinct or HashSet isn’t that big different when it comes to performance. Use a HashSet when the collection should always hold only distinct stuffs. It also tells the programmer that you cant add duplicates to it. … Read more

Converting SELECT DISTINCT ON queries from Postgresql to MySQL

There’s not an exact equivalent to convert a Postgresql query that makes use of SELECT DISTINCT ON to MySQL. Postgresql SELECT DISTINCT ON In Postgresql, the following query will eliminate all rows where the expressions (col1, col2, col3) match, and it will only keep the “first col4, col5 row” for each set of matched rows: … Read more

Criteria.DISTINCT_ROOT_ENTITY vs Projections.distinct

While similar names, the usage is different. I. Projections.distinct(Projections.property(“id”)); this statement would be translated into SQL Statement. It will be passed to DB Engine and executed as a SQL DISTINCT. See: 17.9. Projections, aggregation and grouping so e.g. this example: List results = session.createCriteria(Cat.class) .setProjection( Projections.projectionList() .add( Projections.distinct(Projections.property(“id”)) ) ) .list(); would seems like: SELECT … Read more

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