سؤال

Map properties = new HashMap();
properties.put("javax.persistence.jdbc.driver", "org.firebirdsql.jdbc.FBDriver");
properties.put("javax.persistence.jdbc.url", "jdbc:firebirdsql://localhost:3050/" + DBpath);
properties.put("javax.persistence.jdbc.user", "dbuser");
properties.put("javax.persistence.jdbc.password","dbpassword");
Persistence.createEntityManagerFactory("DB_manager", properties);
DB_ondulatiPUEntityManager = Persistence.createEntityManagerFactory("DB_manager",properties).createEntityManager();

I can create correctly the Entity manager the problem is that the user I use, has granted a specific role in the DB, how can I specify this role in the properties ? Otherwise I get the error "no permission for read/select access to TABLE..."

هل كانت مفيدة؟

المحلول

You can add them to the URL, just like you would when you create a connection directly through DriverManager:

properties.put("javax.persistence.jdbc.url", 
   "jdbc:firebirdsql://localhost:3050/" + DBpath + "?roleName=myrole");
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top