I m new in java persistence api. I have made an application with netbeans6.5 using JPA.Now I m running well with one database but i need to use more database schemas in my application.How can I dynamically change my persistence unit at run time.SO that it starts with a perticular persistence unit that i want.I m using mysql and toplink persistence provider.I just need to change my database schema name in my persistence unit file.Every other details are same.Now, If I want to make a java bean to set the name of persistenceUnit at startup and that beans will be bound to my entity manager in my application, am I on the right way to do this? The problem is that I made that bean but the entity manager is not getting the persistenceUnit name at runtime.I m posting the bean for setting up my persistenceUnit name.Pls help me.