Note that there are some explanatory texts on larger screens.

plurals
  1. PODerby doesn't work when using PHP-Java-Bridge, Why?
    text
    copied!<p>When I access derby through netbeans and log the results everything I get good data, but when I do the exact same thing through PHP-Java Bridge I get no data. In package: </p> <p>com.m1sk.HelloBridge</p> <pre><code> public static String backTest() throws Exception { BackendLink back = new BackendLink(); return back.GetTourists(); } </code></pre> <p>When called though the main I get something like this:</p> <pre><code>[{&lt;Json Representation of the only object in the database&gt;}] </code></pre> <p>This is good, but When I call this function with PHP-Java Bridge</p> <pre><code>&lt;? $test = new Java("com.m1sk.HelloBridge"); echo "!!&lt;br&gt;"; echo $test-&gt;backTest(); ?&gt; </code></pre> <p>I get</p> <pre><code>!! [] </code></pre> <p>Basically it calls the function but for some reason when it accesses the actual database it doesnt get the same thing! </p> <p><strong>Edit</strong></p> <p>*Backend_DAO_DB_impl:*</p> <pre><code>EntityManager em; public Backend_DAO_DB_impl() { String PersistenceName = "XYZ; EntityManagerFactory emf = Persistence.createEntityManagerFactory(PersistenceName); em =emf.createEntityManager(); } public ArrayList&lt;Tourist&gt; GetTourists() { Query q = em.createQuery("from Tourist"); return (ArrayList&lt;Tourist&gt;) q.getResultList(); } </code></pre> <p><em>BackendLink</em></p> <pre><code>public String GetTourists() throws Exception { ArrayList&lt;Tourist&gt; tourists = back.GetTourists(); JSONArray arr = new JSONArray(); for(Tourist t : tourists) { arr.add(JSONConverter.touristToJSON(t)); } return arr.toJSONString(); } </code></pre> <p>back is an object of Backend_DAO_DB_impl The BackendLink works at least when running in eclipse. The problem isnt with the JSONConverter, I checked. So It must be something deeper in the code, meaning its probably something in derby or hibernate.</p> <p>My current guess is that netbeans does something automatically that i'm not doing with the java bridge.<br> <strong>Edit</strong> As requested here are the logs: Catalina </p> <pre><code>Jul 25, 2012 9:16:06 AM org.hibernate.cfg.AnnotationBinder bindClass INFO: Binding entity from annotated class: java5772_5140_9448_modelDB.TouristSite Jul 25, 2012 9:16:06 AM org.hibernate.cfg.annotations.EntityBinder bindTable INFO: Bind entity java5772_5140_9448_modelDB.TouristSite on table TouristSite Jul 25, 2012 9:16:06 AM org.hibernate.cfg.AnnotationBinder bindClass INFO: Binding entity from annotated class: java5772_5140_9448_modelDB.InsideSites Jul 25, 2012 9:16:06 AM org.hibernate.cfg.AnnotationBinder bindClass INFO: Binding entity from annotated class: java5772_5140_9448_modelDB.OutsideSites Jul 25, 2012 9:16:06 AM org.hibernate.cfg.AnnotationBinder bindClass INFO: Binding entity from annotated class: java5772_5140_9448_modelDB.TourReservation Jul 25, 2012 9:16:06 AM org.hibernate.cfg.annotations.EntityBinder bindTable INFO: Bind entity java5772_5140_9448_modelDB.TourReservation on table TourReservation Jul 25, 2012 9:16:06 AM org.hibernate.cfg.AnnotationBinder bindClass INFO: Binding entity from annotated class: java5772_5140_9448_modelDB.Tourist Jul 25, 2012 9:16:06 AM org.hibernate.cfg.annotations.EntityBinder bindTable INFO: Bind entity java5772_5140_9448_modelDB.Tourist on table Tourist Jul 25, 2012 9:16:06 AM org.hibernate.cfg.AnnotationConfiguration secondPassCompile **INFO: Hibernate Validator not found: ignoring** Jul 25, 2012 9:16:06 AM org.hibernate.connection.DriverManagerConnectionProvider configure INFO: Using Hibernate built-in connection pool (not for production use!) Jul 25, 2012 9:16:06 AM org.hibernate.connection.DriverManagerConnectionProvider configure INFO: Hibernate connection pool size: 20 Jul 25, 2012 9:16:06 AM org.hibernate.connection.DriverManagerConnectionProvider configure INFO: autocommit mode: true Jul 25, 2012 9:16:06 AM org.hibernate.connection.DriverManagerConnectionProvider configure INFO: using driver: org.apache.derby.jdbc.ClientDriver at URL: jdbc:derby://localhost:1527/sample Jul 25, 2012 9:16:06 AM org.hibernate.connection.DriverManagerConnectionProvider configure INFO: connection properties: {user=app, password=****, autocommit=true, release_mode=auto} Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: RDBMS: Apache Derby, version: 10.8.1.2 - (1095077) Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: JDBC driver: Apache Derby Network Client JDBC Driver, version: 10.2.2.1 - (538595) Jul 25, 2012 9:16:06 AM org.hibernate.dialect.Dialect &lt;init&gt; INFO: Using dialect: org.hibernate.dialect.DerbyDialect Jul 25, 2012 9:16:06 AM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory INFO: Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory Jul 25, 2012 9:16:06 AM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Automatic flush during beforeCompletion(): disabled Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Automatic session close at end of transaction: disabled Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Scrollable result sets: enabled Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: JDBC3 getGeneratedKeys(): disabled Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Connection release mode: auto Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Default batch fetch size: 1 Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Generate SQL with comments: disabled Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Order SQL updates by primary key: disabled Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Order SQL inserts for batching: disabled Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory Jul 25, 2012 9:16:06 AM org.hibernate.hql.ast.ASTQueryTranslatorFactory &lt;init&gt; INFO: Using ASTQueryTranslatorFactory Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Query language substitutions: {} Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: JPA-QL strict compliance: enabled Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Second-level cache: enabled Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Query cache: disabled Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory createCacheProvider INFO: Cache provider: org.hibernate.cache.NoCacheProvider Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Optimize cache for minimal puts: disabled Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Structured second-level cache entries: disabled Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Statistics: disabled Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Deleted entity synthetic identifier rollback: disabled Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Default entity-mode: pojo Jul 25, 2012 9:16:06 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Named query checking : enabled Jul 25, 2012 9:16:06 AM org.hibernate.impl.SessionFactoryImpl &lt;init&gt; INFO: building session factory Jul 25, 2012 9:16:06 AM org.hibernate.impl.SessionFactoryObjectFactory addInstance INFO: Not binding factory to JNDI, no JNDI name configured Jul 25, 2012 9:16:06 AM org.hibernate.tool.hbm2ddl.SchemaExport execute INFO: Running hbm2ddl schema export Jul 25, 2012 9:16:06 AM org.hibernate.tool.hbm2ddl.SchemaExport execute INFO: exporting generated schema to database Jul 25, 2012 9:16:08 AM org.hibernate.tool.hbm2ddl.SchemaExport execute INFO: schema export complete </code></pre> <p>The other ones seem OK. Im not really sure about that line. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload