I have a table with 11 columns, but I need to get only 2 of them in my application, I\'m using spring/hibernate/DAO combination. For now I have a domain class which includes
If you never need more than those 2 columns of the table, you could change your hibernate mapping to map only those 2 needed columns to the entity class. Only map those table columns you want to access in your application. Keep in mind, that database constraints on the "ignored" columns can be violated like not null constraints, foreign keys or unique constraints.