Roberto Lopez Lopez

Greenhorn
+ Follow
since Jun 16, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Roberto Lopez Lopez

I am using Oracle 12c db and ojdbc7.jar to connect to it. Below is the java code



We had a very similar issue with Oracle 12c and ojdbc7.jar. We found out that using the old ojdbc6.jar instead, solved the issue. Just in case you still have not found a solution to this problem.
I managed to solve the problem. It was due to using jasperreports v1.2.7 and templates compiled using ireport v3.5.2... first time and last time I get trapped into this trick
14 years ago
Hi guys,

I'm building a report using JasperReports 1.2.7 and web services (Spring 2.5.6). I compiled successfully a simple report layout using iReport. But now I'm trying to use it with a JRBeanArrayDataSource and nothing but the headers of the columns is displayed. This is part of my form controller method, where I'm supposed to build the report.



Where NewReport and FilesReport are helper classes. The data is correctly loaded into the attributes reports and result.jreport.






I'm not an expert at all using Spring and JasperReports (it's my first report), any tip please???
14 years ago
Good evening!

I've an app that uses Hibernate 3.2 as ORM. I've a problem at the following code piece:



When the thread reaches the remove call, the following IllegalArgumentException is thrown:

18:08:00,278 ERROR [[action]] Servlet.service() para servlet action lanz� excepci�n
java.lang.IllegalArgumentException: Removing a detached instance es.encore.nollego.comun.to.SubcategoriaPrivadaTO#es.encore.nollego.comun.to.SubcategoriaPrivadaPK@b0d5f5
at org.hibernate.ejb.event.EJB3DeleteEventListener.performDetachedEntityDeletionCheck(EJB3DeleteEventListener.java:47)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:86)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:52)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:766)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:744)
at org.hibernate.ejb.AbstractEntityManagerImpl.remove(AbstractEntityManagerImpl.java:245)
at es.encore.nollego.comun.dao.subcategoriaPrivada.SubcategoriaPrivadaDAO_HBM.remove(SubcategoriaPrivadaDAO_HBM.java:67)
at es.encore.nollego.comun.bo.subcategoriaPrivada.SubcategoriaPrivadaBO.remove(SubcategoriaPrivadaBO.java:42)
...



Has anybody why I get such an exception??? My SubcategoriaPrivadaTO entity is as follows:



Any help will be appreciated! Thanks in advance...
I didn't solved my problem exactly in the way Ramesh Srinivasan suggested, but he gave me an idea... let me explain.

I already had a method which populates the static-data in my database (like the countries table). I'm also using facade and factory patterns, so I did as follows:



As me is an static attribute, the default constructor will be called just once...

I hope it's useful to you...
[ October 08, 2008: Message edited by: Roberto L�pez L�pez ]
Nice tip, question solved.

Thank you Ramesh Srinivasan!!!
Hi there.

I'm working at a project which uses JPA (Hibernate 3) as ORM technology. Everything is running OK, but we need to check if the countries table is empty or not. If it's empty, we have a method which populates it.

We want Hibernate to check this just when it starts up (e.g. after every jBoss restart). Is there any init() method or anything similar that could help us?

Thank you in advance.

[ October 07, 2008: Message edited by: Roberto L�pez L�pez ]
[ October 07, 2008: Message edited by: Roberto L�pez L�pez ]
I've changed my code but still no results.



The executeUpdate() method throws the following:

org.hibernate.QueryException: Expected positional parameter count: 2, actual parameters: [
bdd.subcategoria.compras.alimentacion,
es.encore.nollego.comun.to.UsuarioTO[...]
]
[delete from SubcategoriaTO sc where sc.subcategoria=? and sc.usuarios=?]



Where's the problem?
Hi guys.

I'm dealing with a jpa based app and my basic knowledge doesn't allow me to successfully delete an entity.

I try the following code:

But when I create the query, an exception is thrown:


10:50:44,321 INFO [STDOUT] 2008/09/12 10:50:44 ERROR hibernate.hql.PARSER[http-127.0.0.1-8080-1]: line 1:58: unexpected token: join
java.lang.IllegalArgumentException: node to traverse cannot be null!
at org.hibernate.hql.ast.util.NodeTraverser.traverseDepthFirst(NodeTraverser.java:31)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:254)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:92)
at es.encore.nollego.comun.dao.subcategoria.SubcategoriaDAO_HBM.deleteByNick(SubcategoriaDAO_HBM.java:206)
... 34 more



It seems the problem is the join clause, but I've tried in several ways but didn't succeed. Can anybody help me with this issue?

Here you have the entities:



Previously I've successfully done a select:



Thanks in advance...
Thanks Sachin, nice page... I'll keep it at my bookmarks :-D

Anyway, I've just solved the mistery... I had an error at estimaciones.jsp (a tag mistake) and tiles just displayed that short message "The requested resource is not available"... I don't know why it didn't displayed the error on the console, but finally I found it.

Thank you!!!
[ July 03, 2008: Message edited by: Roberto L�pez L�pez ]
15 years ago
Thanks for your response, Sachin.

I understand your explanation, but just displaying my JSP isn't my real objective. I first tested with that config, but now I need to get the estimaciones.jsp after processing EstimacionesAction.

This is exactly the timeline of what I want:

  • Browser request.
  • struts-config.xml maps to page.estimaciones on tiles-defs.xml.
  • page.estimaciones is composed of: header.jsp, menubar.jsp, copyright.jsp AND /estimacionesContent.do (which generates another jsp).


  • I know it's a little strange but I need to do some operations before getting the estimaciones.jsp.

    Any idea???
    [ July 02, 2008: Message edited by: Roberto L�pez L�pez ]
    15 years ago
    Hi there!

    I'm configuring a struts project to access a mysql db through hibernate. It's my first time configuring hibernate in a project, so I have some problems.

    The more important, and the only I can't solve is this:
  • I have written my hibernate.cfg.xml with the config stuff.
  • I have written some table mappings (and their beans) and introduced them into hibernate.cfg.xml.
  • I have written a plugin to hook hibernate into struts, and declared it into struts-config.xml.

  • I package the whole project (struts + hibernate) and deploy it to my JBoss 4.2.2 server. Then, I get the following output:

    11:39:03,021 INFO [TomcatDeployer] deploy, ctxPath=/XXXXXXX, warUrl=.../tmp/deploy/tmp23130XXXXXXX-exp.war/
    11:39:03,391 INFO [ActionServlet] Loading chain catalog from jndi:/localhost/XXXXXXX/WEB-INF/chain-config.xml
    11:39:03,924 INFO [TilesPlugin] Tiles definition factory loaded for module ''.
    11:39:04,003 INFO [Environment] Hibernate 3.2.6
    11:39:04,010 INFO [Environment] hibernate.properties not found
    11:39:04,015 INFO [Environment] Bytecode provider name : javassist
    11:39:04,024 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
    11:39:04,141 INFO [Configuration] configuring from url: file:/opt/jboss-4.2.2.GA/server/default/tmp/deploy/tmp23130XXXXXXX-exp.war/WEB-INF/hibernate.cfg.xml
    11:39:04,151 INFO [Configuration] Reading mappings from resource : /com/encore/XXXXXXX/hibernate/mappings/Paises.hbm.xml
    11:39:05,535 INFO [HbmBinder] Mapping class: com.encore.XXXXXXX.hibernate.beans.Paises -> paises
    11:39:05,570 INFO [Configuration] Reading mappings from resource : /com/encore/XXXXXXX/hibernate/mappings/Subcategorias.hbm.xml
    11:39:06,870 INFO [HbmBinder] Mapping class: com.encore.XXXXXXX.hibernate.beans.Subcategorias -> subcategorias
    11:39:06,874 INFO [Configuration] Reading mappings from resource : /com/encore/XXXXXXX/hibernate/mappings/SubcategoriasUser.hbm.xml
    11:39:08,213 INFO [HbmBinder] Mapping class: com.encore.XXXXXXX.hibernate.beans.SubcategoriasUser -> subcategorias_user
    11:39:08,214 INFO [Configuration] Configured SessionFactory: null
    11:39:08,383 INFO [DriverManagerConnectionProvider] Using Hibernate built-in connection pool (not for production use!)
    11:39:08,383 INFO [DriverManagerConnectionProvider] Hibernate connection pool size: 20
    11:39:08,383 INFO [DriverManagerConnectionProvider] autocommit mode: false
    11:39:08,384 INFO [DriverManagerConnectionProvider] using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/XXXXXXX
    11:39:08,384 INFO [DriverManagerConnectionProvider] connection properties: {user=administrador, password=ubuntur00t}
    11:39:08,397 INFO [SettingsFactory] RDBMS: MySQL, version: 5.0.51a-3ubuntu5.1
    11:39:08,397 INFO [SettingsFactory] JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.5 ( Revision: ${svn.Revision} )
    11:39:08,421 INFO [Dialect] Using dialect: org.hibernate.dialect.MySQLDialect
    11:39:08,428 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
    11:39:08,431 INFO [TransactionManagerLookupFactory] No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
    [...]
    [...SettingsFactory info...]
    [...]
    11:39:08,506 INFO [SessionFactoryImpl] building session factory
    11:39:09,058 INFO [DriverManagerConnectionProvider] cleaning up connection pool: jdbc:mysql://localhost:3306/XXXXXXX
    11:39:09,251 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured


    As you can read on the last line, the factory isn't bound to any JNDI uri. Could anyone help me? Bellow are my config files.

    hibernate.hbm.xml:

    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
    <hibernate-configuration>
    <session-factory>
    <property name="connection.url">jdbc:mysql://localhost:3306/NoLlego</property>
    <property name="connection.username">XXX</property>
    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="connection.password">XXXX</property>
    <property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
    <!-- thread is the short name for
    org.hibernate.context.ThreadLocalSessionContext
    and let Hibernate bind the session automatically to the thread
    -->
    <property name="current_session_context_class">thread</property>
    <!-- this will show us all sql statements -->
    <property name="hibernate.show_sql">true</property>

    <!-- mapping files -->
    <mapping resource="/com/encore/XXXXXXX/hibernate/mappings/Paises.hbm.xml"/>
    <mapping resource="/com/mmm/XXXXXXX/hibernate/mappings/Subcategorias.hbm.xml"/>
    <mapping resource="/com/mmm/XXXXXXX/hibernate/mappings/SubcategoriasUser.hbm.xml"/>

    </session-factory>
    </hibernate-configuration>



    struts-config.xml:

    <struts-config>
    <!-- ... -->
    <plug-in className="com.mmm.XXXXXXX.hibernate.plugin.HibernatePlugin">
    <set-property property="path" value="/WEB-INF/hibernate.cfg.xml"/>
    </plug-in>
    </struts-config>



    By the way, I don't understand hibernate-service.xml. I have read that I need to introduce the server datasource I want hibernate to use, but in hibernate.cfg.xml I have written the uri of mysql. Isn't it redundant? It's necessary to introduce the datasource in hibernate-service.xml??? Bellow its code:

    <server>
    <mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.har:service=Hibernate">
    <attribute name="DatasourceName">java:/DefaultDS</attribute>
    <attribute name="Dialect">org.hibernate.dialect.MySQLDialect</attribute>
    <attribute name="SessionFactoryName">java:/hibernate/XXXXXXX</attribute>
    <attribute name="CacheProviderClass">
    net.sf.hibernate.cache.HashtableCacheProvider
    </attribute>

    <attribute name="Hbm2ddlAuto">create-drop</attribute>
    <attribute name="ShowSqlEnabled">true</attribute>
    </mbean>
    </server>


    The last question: do I need to separately package the hibernate application to access it from my struts webapp? I'm using ant to package and deploy my war, is there any ant task to package a har? I've searched on google and didn't found anything.

    Thank you very much in advance.
    sudha javvadi:

    Check you got all your jar and xml files from the same version. I had the same problem some days ago and solved it this way. More people had this problem before...

    Good luck!

    [ July 02, 2008: Message edited by: Roberto L�pez L�pez ]
    [ July 03, 2008: Message edited by: Roberto L�pez L�pez ]
    15 years ago
    Ehhhhh you're right Jaikiran! Now I can debug my apps in debug mode. I even can't understand why I didn't succeed before

    Thank you!!!
    [ July 01, 2008: Message edited by: Roberto L�pez L�pez ]
    15 years ago
    Hi there, here comes a tiles beginner question:

    I have written a base definition, from which extends another definition. Here is the content of the tiles-def.xml:

    I have succeeded into configuring everything so I can instantiate the page.estimaciones definition from my struts-config.xml without any exception.

    Anyway, instead of the content of estimacionesContent.jsp, I get the following output:

    :THIS IS THE HEADER
    THIS IS THE MENUBAR
    The requested resource (/NoLlego/web/jsp/struts/estimaciones/estimaciones) is not available
    THIS IS THE COPYRIGHT


    Where's my error??? I can't get estimacionesContent.do from tiles... Maybe is an stupid question, but I started to learn tiles yesterday... Please any tip will be appreciated!!!
    [ July 03, 2008: Message edited by: Roberto L�pez L�pez ]
    15 years ago