Coming from a Java/Hibernate environment, I can map some columns within a table to be a "component" that is belongs to a parent class. For example an User object contains a Preference object, which actually mapped all the attributes into one table in the database.
Is there anything similar in DataMapper? or other database interfacing library?
DataMapper currently doesn't support this feature, but it's on the roadmap and is referred to as "embedded value". ActiveRecord supports defining embedded values already.
As long as DataMapper has no builtin support for embedded values, they can be "faked" by following the pattern outlined in https://gist.github.com/873428