Solved

JPA Create and Read from existing DB

Posted on 2011-09-27
1
412 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
Comment Utility

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Suggested Solutions

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

762 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

6 Experts available now in Live!

Get 1:1 Help Now