I have worked first with Ingres database and there weren't problems there. I have configured my MySQL Database with two Schemas/Catalogs in the same port, one for producers and the other for testing. In the persistence.xml file, I have the following configuration:
<persistence-unit name="my_schema">
... classes ...
<properties>
<property name="hibernate.connection.url" value="jdbc:mysql://URL:3306/my_schema"></property>
<property name="hibernate.connection.username" value="my_user"></property>
<property name="hibernate.connection.password" value="my_pass"></property>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"></property>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"></property>
<property name="hibernate.connection.nombre" value="my_schema" />
</properties>
</persistence-unit>
My Java Entity Classes have the following definition and annotations:
/**
* Constante generated by hbm2java
*/
@Entity
@Table(name = "CONSTANTE", catalog = "my_schema")
public class Constante implements java.io.Serializable {
....
}
When I worked in Ingres, if I wanted to change the schema/catalog, I only needed to change the property "hibernate.connection.url" in persistence.xml:
<property name="hibernate.connection.url" value="jdbc:mysql://URL:3306/my_schema_2">
In MySQL, I have to change the "catalog" annotation in every single class. Is there an easier or more practical way to do this? In fact, in MySQL, I can write whatever I want in the url schema part and the program continues working.