javaormnetbeansjpacrud

Netbeans creating "JPA Controller classes from entity classes"


I want to achieve basic CRUD operations available of the db schema I already have for a JAVA program. To put it in another way, I have a DB schema I use with PHP and I just need them to be entities available in a JAVA application. I discovered I can use Netbeans and sucessfully created Entities from DB!

(Entities look like this: http://pastebin.com/f601b9218)

However when I try to create New > JPA controllers from entity classes in Netbeans I got empty JPA controller classes like:

package javaapplication3;
public class CustomerJpaController {
}

It is empty :) I was expecting CRUD functions inside the generated JPA controller classes as I read from examples and tutorials. What could be the reason of empty JPA controller classes? Is there any other easy way for me to "just" match DB tables with JAVA classes for basic CRUD operation. (I wish there could be easy way to achieve active record pattern)

Thanks in advance.


Solution

  • Usually, I never like to go too much with the wizard thing. But it seems like it should generate the basic CRUD operations, though. I don't know exactly which tutorial you followed. Right now, I am looking at this. After reading this I am getting the same impression, by the way. But may be it just generates the empty classes, and nothing else. I am not sure never tried to do that.

    However, coding it yourself would be quite simple, I believe. Especially when you already got the NamedQueries defined for your entities.