Solved

JPA Create and Read from existing DB

Posted on 2011-09-27
1
414 Views
Last Modified: 2012-05-12
Hi
I have a DB (MSSQL-Server) which I connect using EclipseLink

 
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
  <persistence-unit name="PersistenceTestPU" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <class>persistencetest.Act</class>
    <properties>
      <property name="javax.persistence.jdbc.url" value="jdbc:jtds:sqlserver://localhost:1433/DBNAME"/>
      <property name="javax.persistence.jdbc.password" value="mypassword"/>
      <property name="javax.persistence.jdbc.driver" value="net.sourceforge.jtds.jdbc.Driver"/>
      <property name="javax.persistence.jdbc.user" value="dbuser"/>
    </properties>
  </persistence-unit>
</persistence>

Open in new window


The tables (existing) in the database have names beginning with AAP, thus a table CUSTOMER would be listed as AAP.CUSTOMER when viewed with "SQL Server Management Studio Express"

My problem is, that when I create a table, JPA is creating it as dbo.CUSTOMER

How can I force JPA to write to the AAP.CUSTOMER table

Thanks for helping out


0
Comment
Question by:thomasbau65
1 Comment
 
LVL 47

Accepted Solution

by:
for_yan earned 500 total points
ID: 36711066

Isn't it dfferent schema name?

It probably creates tables in the chema which is default to the user "dbuser"

I guess you can specify it in JPA luike taht:

@Table(schema="aap", name="Messages")
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now