To force the domain objects correct work everywhere, you may want to use lazy property. I don't have any idea what your object looks like, but if has any kind of object relations, you may force them to be non-lazy. Just like this:
class Card {
static hasMany = [cardProperties: CardProperty]
static mapping = {
cardProperties lazy: false
}
}
To ensure you do have some session available, you may want to create a transactional service. Any service would do, but make sure it doesn't contain the line
static transactional = false
If you inject that service to your filters, it will automatically create a transaction and will be able to fetch the lazy properties. But beware! This will begin and finish a transaction. Since you use it in the filter, any page load will have one transaction more.
Another option is to inject the sessionFactory bean to your filter. Then, you may use pure Hibernate syntax. Just like this one:
sessionFactory.getCurrentSession().beginTransaction();
It's not a very good idea, and I would not advise that, but it may work for you. However please note that forwarding the request led to 2 opens of the transaction and 2 closes of the transaction (which is not fine). You'll have to be VERY CAREFUL when deciding whether to commit the transaction. But if you're sure you'll need the database connection on the every page of your app - that may work for you/