No. In your mapping you have an associated object called Product, which must have a property of id. As you have it the only way to get the value of that directly is to refer to it via the Product object.
If you don't want to make reference to the product at all, you will need to add a read only property to your Classification mapping for the product_id.
Out of curiosity, why do you want to avoid refering to the Product object?
In the Classification mapping, there are a few associations with other objects like Product. It looks nice and pretty. But Hibernate actually makes a lot of joins, and the query looks big and slow. Now imagine if the Product mapping also have associations with other objects. Just by selecting a Classification, I end up with a big query joining so many tables.
This is the first time my colleagues and I are using Hibernate. This is a big problem for us. It is not easy to optimize at all.
Its actually quite a common problem. I think you need to read the Hibernate documentation regarding lazy initialization.
If you use lazy initialization in the above mapping, and are only querying the id of product, the only table that will be queried is classification. Why? Rather than querying the product table and populating the properties of an object from database values, Hibernate creates a proxy object on the fly and populates its id based on the value in the foreign key column. There is a lot you can do with Hibernate with regards to query optimization. Its worth getting a copy of Hibernate In Action and reading about the more advanced features.
Just by selecting a Classification, I end up with a big query joining so many tables.
There is a hibernate property setting to the rescue. "hibernate.max_fetch_depth". You can set a numeric value for this and hibernate queries only till that level. Say you set it to 2, only 2 outerjoins are done by hibernate.
If you are not laughing at yourself, then you just didn't get the joke.
Morning came much too soon and it brought along a friend named Margarita Hangover, and a tiny ad.