Jump to content
We've recently updated our Privacy Statement, available here ×

Where is the SVN url for ireport-nb trunk?


ryangardner

Recommended Posts

the link under "sources" looks nothing like the source tree I downloaded from sourceforge.

I'm trying to fix an annoying bug that has apparently been in iReport for several years based on the searches I've done. it is using a normal Hibernate configuarion  - instead of an AnnotationConfiguration -  this means you can't use annotationConfigurations in it. 

It stems from two things - one - that it is explictly using Configuration instead of AnnotationConfiguration - and two - it seems that it requires an act of diety to modify existing library dependencies in Netbeans - so that ancient version of Hibernate has probably stayed there because nobody has any idea how to dislodge it. 

In any case - is there a subversion url for the latest development branch? Is there any IDE other than netbeans with project files for this project? 

Link to comment
Share on other sites

  • Replies 15
  • Created
  • Last Reply

Top Posters In This Topic

 

Hi Ryan,

I'll happy to assist you. Here is the source code:

svn checkout --username anonsvn http://jasperforge.org/svn/repos/ireportfornetbeans

You should install the NetBeans platform 6.0.1 in your environment in order to successfully compile and run iReport (see for a post about iReport NB plugin development).

What Hibernate version do you suggest to add to iReport?

Giulio

Link to comment
Share on other sites

that sounds good to me. the AnnotationConfig should work even if annotations aren't being used - but having a checkbox to disable it sounds like a good idea to me.

 

As far as the hibernate version - I think the latest is 3.3.1GA

 

I'll try checking that version out and seeing if I can do anything to help.

 

How is Netbeans support for something like Maven? Perhaps migrating to a maven-based project would make handling dependency versions extremely easy (and would have the side benefit of making parts of the project more IDE-agnostic - since both NetBeans and IntelliJ seam to like Maven - and eclipse users can always generate eclipse files from their maven pom files)... the other side benefit would be you don't have to have 50 megs of jar files in your source distributions any more. Netbeans GUI stuff obviously would stay netbeans only - but just a thought...

 

I could help with maven migration if you were interested in it - but if s

Link to comment
Share on other sites

The NetBeans modules development strongly relays on Ant, and all the jars required by iReport are declared in an xml file that's part of the module metadata definition.
I don't see the benefit of using maven in this particolar project, it would be just another source of pain ;-) but if you find a good reason to use it feel you free to make a proposal to make the iReport development easier.

Currently you don't need NetBeans to compile ireport, only a netbeans platform. The rest can be done using ant and the command line (even if I really would like to see someone using eclipse to write an ireport NB plugin, which is possible by the way...but you would renunce to all the cool modules development wizards that NB offers).

Anyway I just downloaded the last version of Hibernate, 3.3.1 GA, I'll look for the jar we need. I saw there is an Annotaion distribution too, is it required for annotation configurations?

I'm not an Hibernate master, so I'll do of my best to setup an sample Hibernate environment to test the result.

Thanks for your support.

Giulio

 

 

Link to comment
Share on other sites

Hm.

 

I've finally got my project building and I've tried to throw in the hibernate jars, but haven't had success yet. In addition to the hibernate jars, the latest hibernate needs slf4j to work. I might have had it all in place once but then got some exceptions in something and that was before I discovered the IDE log menu option to debug that... So now I'm still kind of banging my head against it.

 

Is there an easy way to launch the production app in a way that a debugger can attach to it? I'm more of a web developer than an app developer - and I don't see the normal main method (because its probably part of the nbplatform - so that's to be expected).

 

All I'm doing at this point is swapping out jars that get included in the ireport/modules/ext/ directory. Can I just swap out jars there and update some xml file and then run again? (or do I even need to update any file other than just swapping out jars in that directory while I'm trying to pin down what exactly is needed?)

 

Link to comment
Share on other sites

Hi Ryan,

I just completed the Hibernate 3.4.0 GA support with annotations. The only important thing to know about the implementations is that you have to specify a complete JDBC connection in the hibernate conf file (with url, driver, user and pass), it does not work with datasources and connection poolers are skipped (I implemented an HibernateConnectionProvider to avoid classpath problems with the JDBC drivers not being found, I had to do the same to access Mondrian OLAP server).
I tested all with a very simple use case without problems.

SVN repository updated.

Have fun

Giulio

Link to comment
Share on other sites

Thanks for your help on this - but unfortunately - I'm not having luck with it yet :( 

Here's the IDE log.

http://pastebin.com/fca44d3c 

Here's what my hibernate.cfg.xml looks like - see any glaring errors?

 

 

 

<hibernate-configuration>

    <session-factory>

        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>

        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/MYDB</property>

        <property name="hibernate.connection.username">root</property>

        <property name="hibernate.query.substitutions">true 1, false 0</property>

        <property name="hibernate.generate_statistics">true</property>

        

        <property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>

        

        <mapping package="com.foo.domain" />        

 

        <mapping class="com.foo.domain.Address" />

        <mapping class="com.foo.domain.ContactPreference" />

  ..(the rest of the mapping classes)..    

        <mapping class="com.foo.domain.User" />

 

    </session-factory>

</hibernate-configuration>

 

 



Post Edited by Ryan Gardner at 04/09/09 03:33
Link to comment
Share on other sites

Yes, you are using everywhere the prefix hibernate for the properties, that should not be used in hibernate.cfg.xml

See my one for example:

<?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>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/test</property>
<property name="connection.username">root</property>
<property name="connection.password">sa</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">none</property>

<mapping class="com.jaspersoft.beans.Employee"/>

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

 

Giulio

 

Link to comment
Share on other sites

Thanks for your help - I can get it now to say it is able to connect. I had to remove my mapped package element - which I believe only identifies the place to grab named queries, and I had some of my @Embeddable pieces mapped in mapped class  elements which was causing it to fail also.

Now that the connection loads, I'm wondering if there is something else I'm doing wrong.

If I go to create a report using this datasource, none of the fields show up in the list and when I go to edit the query in HQL it doesn't show any beans in the righthand side.

It seems that this is getting closer now. I wonder if something such as my use of enums is causing it? (I have a few fields marked with @Enumerated(EnumType.STRING) - I think the EnumType is new to the annotations for hibernate and wasn't in the older versions - maybe this is making somme internal code barf?)

 

Is there a way to configure a more verbose logging level? The IDE log doesn't give any indication why the list of fields is empty.

 



Post Edited by Ryan Gardner at 04/09/09 16:19
Link to comment
Share on other sites

1. Create a log4j.properties file, i.e.:

# Default Logging Configuration
log4j.rootLogger=INFO, stdout
#to increase logging level
#log4j.logger.org.dcm4cheri=DEBUG
#to decrease logging level
#log4j.logger.org.dcm4cheri=ERROR

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.appender.stdout.Target=System.out

2. Run iReport with this argument (adjust the right location of your log4j.properties file)

-J-Dlog4j.configuration=file:/C:/test/log4j.properties

If you run iReport form the IDE, this argument should be put in the Per-User project properties:

run.args=-J-Dlog4j.configuration=file:/C:/test/log4j.properties

otherwise you need to modify the <ireport install>/etc/ireport.conf
or simply run iReport from a command prompt with that command line argument:

 -J-Dlog4j.configuration=file:/C:/test/log4j.properties

Giulio

Link to comment
Share on other sites

 Ok, I did some more testing and debugging. 

I WAS able to get it to work. When I got it connected to my debugger and was stepping through it, everything in the hibernate annotation scanning looked like it was working perfectly fine - so I was confused why it didn't seem to work. 

What I was seeing was that I would create the new report from a HIbernate datasource, but when I got to the list of fields I wouldn't have any fields listed - which I thought was an error. I see in the code now that the hibernate datasource doesn't give a list of fields - so after picking the datasource the rest of the wizard is pretty empty. 

After going in and selecting the report and then editing the query - it works. I can type in my hql queries and I see the fields loaded in the list and I am able to build and preview reports. 

So - thanks for your work. Now I need to go learn how to use the tool itself :) 

It might be worth considering putting that query box right after the datasource box for the hibernate datasource - because I imagine if you have the user enter in an HQL query after specifying the datasource that you will then get a list of fields and the rest of the report wizard should work properly. I'm definitely a newbie when it comes to the netbeans platform but once I get the basics done I can look into helping with that (if someone else hasn't done it already).

Thanks - I can confirm that with my existing annotation config  (although I it was slightly modified - I had to remove the mapping package= part , and i did put the explicit jdbc stuff in it ) I was able to build some simple reports and see data pulled from my database in the preview window. 

Link to comment
Share on other sites

  • 2 weeks later...

why can't you just do something like this... on the JRSpringLoadedHibernateConnection class?


Code:
    @Override    public java.sql.Connection getConnection() throws java.sql.SQLException {            return getDataSource().getConnection();    }    public javax.sql.DataSource getDataSource() {        return ((AbstractSessionFactoryBean)getApplicationContext().getBean("&"+getSessionFactoryBeanId())).getDataSource();    }
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...