hibernate - Cant get basic JPA working in a dropwizard application -


i trying persist object database using dropwizard's jpa annotation.

the object persisted

theobject.java

    @jsonignoreproperties(ignoreunknown = true)     @entity     @table(name = "theobject")     @namedquery(name = "com.comany.theobject.findall", query = "select o theobject o")     public classtheobjectimplements  serializable{          /**          *           */         private static final long serialversionuid = 1l;         @id         @generatedvalue(strategy = generationtype.identity)         @jsonproperty         string name;          @onetomany(cascade = cascadetype.all, mappedby = "theobject", fetch = fetchtype.eager)          public void setname(string name) {             this.name = name;         }          public string getname(long id) {             return this.name;         }          public theobject (string name) {             this.name = name;         }      data access object   public theobjectdao(sessionfactory factory) {         super(factory);     }      public list<theobject> findall() {          return list(namedquery("com.comapny.theobject.findall"));     }      public theobject create(theobject o) {         return persist(o);      } }  application class       public class theapplication extends application<appconfiguration> {     private final static logger log = logger.getlogger(deployerapplication.class.getname());       private final hibernatebundle<appconfiguration> hibernate = new hibernatebundle<appconfiguration>(         theobject.class) {          public datasourcefactory getdatasourcefactory(                 appconfiguration configuration) {             return configuration.getdatasourcefactory();         }      };     @override     public void run(appconfiguration configuration, environment environment) throws sqlexception {            final theobjectdao dao = new   theobjectdao(hibernate.getsessionfactory());     environment.jersey().register(new theobjectresource(dao));    , resource class      public objectresource(theobjectdao edao) {         this.dao = dao;     }      @get     @timed     @unitofwork     public list<theobject> getallobjss() {         return dao.findall();      } 

when tru resource error "named query not known". have missed

got it, had namedquery syntax wrong. should have been @namedqueries({ @namedquery( name = "", query = "" ) })


Comments