Witold Marshal

Ranch Hand
+ Follow
since Feb 05, 2012
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Witold Marshal

I have annoted classes (entities). But I can use orm.xml too if there is no solution for entities.
I have seen a few examples of such SARs with JAR's inside on web without classloader. Even Hibernate documentation mention about such project.

I can do it with Winrar but I was expecting that Eclipse has this capability.
Yes of course. But it doesn't work. They are treated as normal libraries for JAR and during export they are not being enclosed to the SAR.
I am trying to make SAR MBean with Eclipse. I take a "new SAR Project" in "New" option. The project is created but I don't know how to enclose additional jars that will get exported togerther with the whole SAR archive when I export it.
Thanks for this new header but it gives no results as the previous one (The same error). Propably it can't find this xsd schema. The strange thing is that when I change header on this for version 3.x (3.0.dtd) it works. And both schema files (xsd and dtd) are in the same folder "org/hibernate" of Hibernate libraries.
My application is meant for JSE environment, JDBC connection, run from Eclipse or executable jar (in both cases result is the same).
Here you have all the materials:

My cfg.xml looks like this:

If I pack it to executable jar then I have Manifest.mf which indidcates Hibernate jars:

So the Hib. version is for sure 4.1.2

And here is whole printstack from Exceptions:

When I write "does not work" I mean that I get an arror concernig header. I exactly get:
ExceptionInitializerError caused by MappingException: invalid configuration
lover there is another cause:
SAXParseException: Document is ivalid: no grammar found.

As I mentioned, when I change header on old version (3) the application works perfect (although it is using libraries from Hibernate version 4.x).
Thanks for that link to documentation but my header is exactly the same. To avoid missing any difference (single letter) I have copied it to my application and doesn't work to. I suspect this is the only version of Header for Hib. 4 on the net and that is why the one I have found is the same that you have indicated in this documentation.
I haven't tried to modify this header by changing the name of xsd file because I a newbie in that issue and I rely on standard settings. I use link to standard file "hibernate-configuration-4.0.xsd".
I am looking for a good description how to deploy hiberante libraries and application (for example EJB that uses Hibernates Seesion for performing some database actions ) on JBoss (I use 6 version) and I can't find a consistent approach to this case. Can anyone put some light on this issue because I'm wasting hours on thing that I susspect should be easy with appropriate instructions.
I was reading some articles like this:
and I am getting mor confused.
Please let someone explain me some basic things.
Lets assume that I want to make an EAR with EJB that usese Hibernate libraries.
First of all where should i place Hibernate Libraries ? Sshould they be in thie EAR (lib directory) or should they be deployed on server (servers "lib" directory)?
In the articles given above they don't mention about it.
They are using some service-hibernate.xml file in this projects for (as I susspect ) configuring SessionFactory. But does it mean that basic configuration file hibernate.cfg.xml is no longer needful? As I was convinced the cfg.xml is a basic file for Hibernate and there should be placed settings for configuring SessionFactory in managed environment (server). I am thinking about properties for SesionContext, JTAFactory or Transaction Manager Lookup. Should I set those properties in service-hibernate.xml instead of cfg.xml?
What about utility class usually named as HibernateUtil which was producing SessionFactory singleton instance from cfg? Is it needless too? What causes SessionFctory to be created? server itself without any "builtSessionFctory()" call?

There is reportedly a second approach to this development with JMX service. But it is not well described too. In some articles it is mentioned taht I have to add only jboss-service.xml file to Meta-INF of my EAR. In some places they write that I should bulid special SAR archieve with this jboss-service.xml and Hibernate libraries.
Does this approach not use cfg.xml file and HibernateUtil class too?

If you have any information about it or link to good article (on time), please write it down because I am really tired with this subject.

I talk with someone who knows the xsd schema isssue very well and he says that the http doesn't have to indicate appropriate location to the xsd file because this file is in one of hiberante jars (I have found it there) and all the request for this schema are rediverted there. So this is not an answer why it doesn't work.
I am starting with Hibernate. i have downloaded version 4.1. What header should I use for my cfg.xml files?
In documentation there is no word about it. In their examples they are using standard (old) header:

It indicates hibernate configuration version 3.0. When I use it my basic aplication it works fine but shouldn't I use a newer header for my Hibernate 4.1?

I have found on the net en axample of such header but i doesn't work for my aplications:

So is there enything else for Hibernate 4 or should I use old type of header?
I was expecting that Eclipse would download the necessary library jar from repository as Maven does it when it downloads dependencies. I thought that pom contains necessary information for downloading that jar.
I want to download some libraries (jars) from remote global repository but without adding them as dependecies to Maven Project in Eclipse.
I thought thta it is possible through Eclipse menu:
File>>Import >>Maven>>Materialize Maven Project from SCM >> Add (Maven Artifacts)
Then in artifact window I lookup for needed jar library i global repository. I choose one and hit finish. Some sha1 and pom files are downloaded to repository's folder automatically created for that project.

Next I try to install artifact:
File>>Import >>Maven>>Install or deploy an artifact to Maven reository
In the opened window I browse the pom file that was downloaded in previous step. I hit "finish". After this a jar file with appropriate name is created but it is not a jar indeed. It is wery small and winrar shows error while I'm tying to open it. It says that this is not a jar library.

Does anybody know how to do it properly?
Insted calling persist second time (which will obviously cause an Exception) call merge on that instace after setting new object into relation list. Merge after cascading will create new records from instances stored in the list.