001    package net.databinder.models.hib;
002    
003    import org.apache.wicket.model.IDetachable;
004    import org.apache.wicket.model.IModel;
005    import org.hibernate.Query;
006    
007    /**
008     * A query binder that sets query parameters to corresponding properties taken
009     * from the given Wicket model object.
010     * 
011     * @author Jonathan
012     */
013    public class ModelPropertyQueryBinder extends AbstractPropertyQueryBinder
014                    implements IDetachable {
015    
016            private static final long serialVersionUID = -6544558086991812867L;
017    
018            protected final IModel model;
019    
020            public ModelPropertyQueryBinder(final IModel model) {
021                    this.model = model;
022            }
023    
024            public void detach() {
025                    model.detach();
026            }
027    
028            public void bind(final Query query) {
029                    bind(query, model.getObject());
030            }
031    }