I have a class `A` with a method `foo()` that behaves differently depending on some configuration value:

```
class A {
    private transient Config config; // How do I set this field?

    public int foo() {
        return config.hasKey("bar") ? 1 : 2;
    }
}

```

A persistence framework like Hibernate creates instances of `A`. How can I inject the current value of `config` into the instance?

Note: I'm using OJB, not Hibernate but the problem itself is always the same. It boils down to: I have some framework that creates instances for me. How can I reliably inject values into instances created outside of my control?

Performance is an issue here since millions of these objects are created.