Results 1 to 2 of 2

Thread: [RESOLVED] Persistence Unit

Hybrid View

  1. #1

    Thread Starter
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Resolved [RESOLVED] Persistence Unit

    Hi,

    I am on my Windows 7 Professional laptop using Netbeans 6.9 to do my Java homework which requires the use of a Persistence Unit. However, the connection to the database isn't recognized and when I go to create "New Data Source" and fill in the appropriate information then press "OK" the new Data Source does not appear in the list. Why is this?

    Thanks,


    Nightwalker
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  2. #2

    Thread Starter
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Persistence Unit

    After taking the following steps to try and rectify the problem I had to manually edit the presistence.xml file and change the needed fields.

    1. Create a new Java web project
    2. Create a new database
    3. Connect to database
    4. Create a new "Entities" package
    5. Add a new Entity class
    6. Create persistence unit
    7. Select provider and data source ( or create new data source)

    xml Code:
    1. <?xml version="1.0" encoding="UTF-8"?>
    2. <persistence version="1.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_1_0.xsd">
    3.   <persistence-unit name="WebApplication2PU" transaction-type="JTA">
    4.     <provider>oracle.toplink.essentials.PersistenceProvider</provider>
    5.     <jta-data-source>jdbc/test</jta-data-source>
    6.     <properties>
    7.       <property name="toplink.ddl-generation" value="create-tables"/>
    8.     </properties>
    9.   </persistence-unit>
    10. </persistence>

    I think in more cases the above steps will still work. Although, I'm still at a loss as to why the problem occurs.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width