Best way to combine Java Persistence API (JPA)  with Visual Web Pack (VWP)?

I like the JPA/Hibernate development approach to create the database elements from JAVA classes.
This way one gets rid of the need to keep JAVA code and the database in sync.
However I have not yet found a good way on how to use JPA from the netbeans VWP.
Note that I have found the tutorial on how to use the IDE with hibernate and it works without problems.
However I think this tutorial does not really implement a good Model/View/Controller approach as it is done in the enterprise pack.
Here you have a controller session bean that deals with all the persistence logic and that exposes properties through a DataModel to the application.
There is no need to encapsulate logic in inherited classes of the ObjectListDataProvider.
Maybe an example makes it more clear:
If we stay with the hibernate tutorial that we have "Animals" and "Pavillion" entities.
How would one efficiently design a "Table" component that shows a list of all Animals and their Pavillions.
With the VWP approach it is quite clear: you create a RowSet with the inner/left join between Animals and Pavillions.
But how would you do it with JPA?

You said:
"If we stay with the hibernate tutorial that we have "Animals" and "Pavillion" entities.
How would one efficiently design a "Table" component that shows a list of all Animals and their Pavillions.
With the VWP approach it is quite clear: you create a RowSet with the inner/left join between Animals and Pavillions.
But how would you do it with JPA?"
I have the exact same question. Have you found the answer on how to "join" entities and display them on visual web table component?

Similar Messages

  • DAO pattern and Java Persistence API

    Hi
    This is a question for anyone who might be familiar with the standard DAO design pattern and the Java Persistence API (JPA - part of EJB3). I'm new to this technology, so apologies for any terminology aberrations.
    I am developing the overall architecture for an enterprise system. I intend to use the DAO pattern as the conceptual basis for all data access - this data will reside in a number of forms (e.g. RDBMS, flat file). In the specific case of the RDBMS, I intend to use JPA. My understanding of JPA is that it does/can support the DAO concept, but I'm struggling to get my head around how the two ideas (can be made to) relate to each other.
    For example, the DAO pattern is all about how business objects, data access objects, data transfer objects, data sources, etc relate to each other; JPA is all about entities and persistence units/contexts relate to each other. Further, JPA uses ORM, which is not a DAO concept.
    So, to summarise - can DAO and JPA work together and if so how?
    Thanks
    P.S. Please let me know if you think this topic would be more visible in another forum (e.g. EJB).

    Thanks, duffymo, that makes sense. However ... having read through numerous threads in which you voice your opinion of the DAO World According to Sun, I'd be interested to know your thoughts on the following ...
    Basically, I'm in the process of proposing an enterprise system architecture, which will use DAO as the primary persistence abstraction, and DAO + JPA in the particular case of persistence to a RDBMS. In doing so, I'd like to illustrate the various elements of the DAO pattern, a la the standard class diagram that relates BusinessObject / DataAccessObject / DataSource / TransferObject (http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html). With reference to this model, I know that you have a view on the concept of TransferObject (aka ValueObject?) - how would you depict the DAO pattern in its most generic form? Or is the concept of a generic DAO pattern compromised by the specific implementation that is used (in this case JPA)?

  • Java Persistence API and creation of databases

    Hi All
    I have designed a small address book application which uses a database to store the information. I have used the new Java Persistence API to take care of my transactions and querrys with the database. This works great for one set database which is generated the first time the application runs and is used all the time.
    However I would like to make it so that the user can create a new address book (database) with a different name, I am not sure how I would do this using the Java Persistence API. I know the persistence.xml file must be placed in the META-INF directory of the source, so how would I be able manipulate the file or could I place the file somewhere else.
    David

    I am using the Derby database. I can create a database by passing the create command when I create the entity Manager like so:
    Connection c = DriverManager.getConnection("jdbc:derby:AddressBook;create=true", "app", "app");My problem is that as I understand it the persistence.xml file must know the name of the database. Unless there is another way of setting this. The line in the persistence file I am referring to is:
    <property name="toplink.jdbc.url" value="jdbc:derby:AddressBook"/>I wonder if I can progamatically set this value so that I have a default database in the persistence.xml and others can then create there own.
    David

  • Best way to implement auto increment in JPA.

    What is the best way to implement auto increment in JPA so that it will support all databases such as MySQL, MSSQL Server, Oracle etc. ? Or is there any way to set auto increment strategy in common place such as persistence.xml? Please help...

    All JPA strategies require something (like a table or sequence object) be in the database, with table sequencing being the most portable, though EclipseLink does allow custom sequence stratgies where you could use something else, such as the UUID. Sequencing is described here described here http://wiki.eclipse.org/EclipseLink/Examples/JPA/PrimaryKey with a custom UUID example shown here http://wiki.eclipse.org/EclipseLink/Examples/JPA/CustomSequencing .

  • Java persistence api : ejb ql

    Hi,
    I am using java persistence api(over oracle toplinks)
    I have an entity customer and another entity contacts.
    customer is mapped with contact as one to many.
    the contact have a field primarycontact.
    I want to get the contact name from contacts for a customer where primarycontact field is true. and set this contact name as a field customercontact which is a string in customer..
    I got a way by executing multiple queries.
    but is it possible to do this in single query using ejb ql?
    Any help will be greatly appreciated..
    Thanks in advance....

    @Id
    @GeneratedValue( @GeneratedValue(strategy= GenerationType.TABLE, generator="SOMENAME")
    public int setId() {
    returrn this.id;
    in the database you need to create table using following commands
    CREATE TABLE SEQUENCE
    SEQ_NAME VARCHAR(50),
    SEQ_COUNT DECIMAL(15)
    and insert a row initally with the same "SOMENAME" like
    insert into sequence values ( "SOMENAME", 1);
    you can get the next id by adding 50(default) to "SELECT SEQ_COUNT FROM SEQUENCE WHERE SEQ_NAME = "SOMENAME"
    hope this provides a solution.

  • Newbie question on Java Persistence API - Entity Beans

    Hi All,
    I am basically new to Entities and the Java Persistence API. My question is, when using a container managed EntityManager, do I have to manually tidy-up any resources? Say for example, do I have to explicitly close the database connection (if ever I have that ability)? Invoke close() on EntityManager?
    - Pat

    You don't have to. That's what they mean by container managed. The container does it for you.
    In fact you will get an IllegalStateException if you call close on a container-managed EntityManager.

  • Question about Java Persistence API.

    is Java Persistence API a Object-Relational Mapping Framework, or the java Programmer can use this API to do mapping between Java Applicatiion and Relational Database ??

    http://java.sun.com/javaee/overview/faq/persistence.jsp

  • HT4260 I have an AirPort Extreme and a linksys router. What is the best way to get 6-8 wired connections with ac speeds?

    I have an AirPort Extreme and a linksys router. What is the best way to get 6-8 wired connections with ac speeds?
    Appreciate your assistance.

    The answer depends on whether the AirPort Extreme is your main router....or...the Linksys device is your main router.
    In either case, the two devices must connect together using a wired Ethernet connection using CAT5e or CAT6 cabling.
    Any version of the AirPort Extreme produced within the last 5 years will have Gigabit Ethernet ports. In order to get the same speeds from the Linksys router, it will also need to be Gigabit Ethernet capable.
    If you need additional Ethernet ports, you will need to add a Gigabit Ethernet switch to either the AirPort Extreme or Linksys router.
    It is assumed that your other devices connecting to the AirPort Extreme and Linksys router will also have Gigabit Ethernet capability.
    Not sure why you mention "ac" speeds in your post. This relates to wireless connections, not wired.

  • Dw, css, and a template, what is the best way to create a 20 page website with a different header in each page?

    dw, css, and a template, what is the best way to create a 20
    page website with different header content on each page? i am
    trying to insert a specific image and background color for each
    header on every page. what is the easiest or best way to do this?
    thanks, bryan

    "mediastream13" <[email protected]> wrote in
    message
    news:f47bes$9om$[email protected]..
    > ok, murray, here is the site.
    http://www.helphotline.org
    > in I.E. 6 i can't see the background color behind the
    header images,
    I'm seeing a hot pink background (which is my browser default
    - so that I do
    remember to declare a background color). You need to add:
    body { background-color: white;} to your stylesheet, or into
    the imbedded
    styles on your page.
    In Firefox, the very top black section, #headertop is hidden
    behind the
    header image.
    > background of the date/time isn't stretching the full
    length of the
    > screen, and
    > the margins aren't working in the main content area. how
    can i put a
    > background
    > color behind the header images?
    I can see the header image stretching right across the page..
    so not sure
    what color is missing there.
    > is there anyway to download i.e. six on my computer if i
    already have
    > i.e.7? i
    > just want to be able to preview the site before i upload
    the changes. it
    > seems
    > everything works in i.e. 7.
    Yes, I used this and it works really well.
    http://tredosoft.com/Multiple_IE
    Nadia
    Adobe® Community Expert : Dreamweaver
    CSS Templates |Tutorials |SEO Articles
    http://www.DreamweaverResources.com
    ~ Customisation Service Available ~
    http://www.csstemplates.com.au

  • Best way to integrating mac os x client with Active Directory

    Hi hello
    What is the best way to integrating mac os x client with Active Directory ? i have one Lion Server
    For the Mac client i want Mac use Active Directory for authentification and Lion Server for manage preference.
    Tell me in lion server the magic triangle is it good for what i want do ?? 

    If you have a need now and that need will remain serviceable long enough to justifying the investment, then go with Lion Server and do the Magic Triangle.  This is nothing more than Binding OS X Server to your AD domain and kerberizing services.  Then bind your workstations to AD first, then OD.  Make sure you download Server Admin Tools for Lion.  This gives access to Workgroup Manager.  That is were you will manage your OS X Settings.
    If you are managing more than 50 Macs that need a lot of continued management, then look at JAMF. 

  • Best way to sync (shift to match) audio with video in FCE 1.01?

    What is the best way to sync (shift to match) audio with video in FCE 1.01?
    Step by step in simple wording please, since I am new at this.
    Thank you so much.
    Walter

    As you probably know by now, DVD camcorders are not compatible with FCE or pretty well any other DV based editing system.
    Possibly the simplest (though not cheapest) route would be by using an Analogue-Digital converter.
    Streamclip and other similar programs are supposed to work but I have had no experience with them.
    In the long run probably the best (but costly) solution would be to buy a Mini-DV camcorder - it doesn't have to be a top of the range model - even the cheapest ones can produce high quality video. Then you would not have to mess around converting DVD files with the inevitable loss of quality it entails.
    A cheap DV camera need be not much more expensive than an A/D converter.
    Ian.

  • HT3819 what is the best way to set up my childs iphone with apple id and as part of home sharing?

    what is the best way to set up my childs iphone with apple id and as part of home sharing?

    So do I have to hook up an Ethernet cable to both the Uverse AND my computer from the Time Capsule?
    I'm not sure that I understand everything that you want to do and where devices will be located.
    The Time Capsule must connect to the "main" Uverse router using a permanent, wired Ethernet cable connection. An Ethernet cable can be run up to 300+ feet with virtually no loss, so you should be able to locate the Time Capsule wherever you want.....unless you have a very large estate.
    If you want the Time Capsule to strengthen the wireless signal provided by the Uverse router, then the Time Capsule must be located in the area where you need that additional signal strength.
    If I understand your post correctly, you plan to install the Time Capsule in the office? When you do this, you can configure the Time Capsule to create a wireless signal that uses the exact same wireless network name and password as the Uverse wireless network.
    That will provide a much stronger signal for your Uverse wireless network in the office area. Hopefully, the bedroom that you mention is close to the office, so it will pick up the stronger wireless signal from the Time Capsule.
    The iMac in the office can connect to the Time Capsule using another short Ethernet cable connection, or the iMac can connect using wireless.  A wired connection is always preferred, if possible.
    At this point, I guess the first question would be.......
    Do you have a location for the Time Capsule that will be close to the office....and...the bedroom where you want a stronger wireless signal?

  • Is Using Netbeans the best way to learn Java?

    hi all. this is my first post.
    okay, I am total n00b. But I have been flirting with the idea of learning to code for about 2 years, and I think I need to leanr java, though I hear it is a difficult first language. but i love the platform independence thing. so a question.
    is it a good practice to learn the language with netbeans, or just with a text editor? i am leaning to netbeans but thought i'd ask others.

    Encephalopathic wrote:
    Understand though that if you ask this question to 20 different folk here, you'll get 20 different answers. Also realize that this has been asked 3,428 times here.all sane people will tell you that using Notbeans may not be the worst way (that would be BlueJ) but is far from being the best way (which would be VI).

  • Best Way to Implement Java Onscreen Keyboard Input

    Hello!
    I'm working on an embedded device that will run J2SE, using a touchscreen, but no keyboard. The UI will be in Swing. When the user focuses a text field, I'd like an on-screen keyboard to be displayed.
    My question is as to the best way to have Swing text component receive the key events (?) that this keyboard will generate. The options I saw so far are
    1. Write an input method provider
    2. Use java.awt.Robot
    But I think I might be missing some easier way.
    Thanks for advice, or pointing me to an existing project.
    ~Jesse

    Thanks for the idea! It sounds quite a bit simpler.
    So basically, I'll attach a focus listener to each of my text components, and when one receives focus it will
    1. Display the keyboard on screen
    2. Pass its document and caret to the keyboard class.
    When the user "types" on the keyboard, it will modify the Document and Caret appropriately. I assume all Swing text components listen for document changes - so this should work nicely.
    Best,
    Jesse

  • Best way to combine 8-bit and 16-bit image files?

    I produce large photographic art prints by combining my own edited 16-bit RAW photo images with 8-bit stock photo images and 8-bit photoshop artwork. I used to just reduce my 16-bit photos to 8-bit and then edit my composite image as 8-bit, but I ran into banding and other problems in the color gradients I created later in my composite image.
    I want my composite image to be 16-bit to get more accurate colors and better gradients. What is the best way to bring 8-bit image files into my composition and maintain best quality? Is it good to convert 8-bit images to 16-bit in PS before importing? I also heard about bringing 8-bit images in as Smart Objects? Thanks for any help on this.

    *Photonic wrote:
    Thanks Jack and Noel. My workflow usually starts w. a 16-bit RAW image brought into Photoshop as the background layer of the master file. Color space is AdobeRGB. Then 8-bit stock photo and art elements (objects) are brought in by dragging the open 8-bit image up to the master image file tab, and then dropping it back into the image window after the file opens.
    Should I use the "Paste In" command instead? I usually avoid copy/paste since some of my element files are usually over 100MB and that seems to challenge my Mac after a while.
    Could I convert the 8-bit image files prior to import, like Noel suggests (Image>Mode>16bits)?  Thanks.
    There is no need to convert 8bit open documents to 16bit mode Photoshop will convert the copied layers to 16bit bit during the drag copy.  Converting the open document would just increase Photoshop RAM usage every layer pixels bytes used  would double in size.
    If you element files are over 100MB they are most likely layered files.  If all you need is a composite you should avoid using Place for that will needlessly inflate your document size. Instead open the element file create a new layer that is a stamp visible layer (Shift+Alt|Opt+Ctrl|Cmd+E) and drag that layer to you document then close nosave your element file. Copy only copies the targeted layer or there is a Copy Merge that copies the composit merge of all targeted layers. It a bit hard to create an action that would be able to use Copy or Copy Merge. Using the above stamp visible way can be made into an action. You also do not want to drag all the layers to your document if you just need a composit layer.
    You could also automate the element file copy with an action.
    Action Step 1 Insert menu into File>Open this will be an interactive step you must select a file to open. When the action is played.
    Step 2 (Shift+Alt|Opt+Ctrl|Cmd+N) Create a new empty layer This will always work
    Step 3 (Shift+Alt|Opt+Ctrl|Cmd+E) stamp visible layers into the new layer
    Step 4 (Ctrl|Cmd+A) select all
    Step 5 (Ctrl|Cmd+C) Copy
    Step 6 Close current document no save
    Step 7 (Ctrl|Cmd+P) Paste into the document your working on Photoshop will convert to 16bit if the document is 16bit mode and the clipboard content is 8bit.
    When you use Photoshop and do something.  Think to yourself how did Photoshop do what you asked it to do. Thing about what is involved what layers must be used etc. How is the feature/function done.
    Message was edited by: JJMack
    Message was edited by: JJMack

Maybe you are looking for