[JBoss Tools (users)] - Re: Hibernate reverse engineering errors
by max.andersen@jboss.com
"bdlink" wrote : For the last couple of years, I have been trying hibernate reverse engineering on a test database with seam-gen or JBT. It is improving, but does not work out of the box. (work, in terms of generating examples that will compile). I think all of the issues are in JIRA.
|
If you know which issues that is stopping you list them (and vote on them ;)
anonymous wrote :
| At the moment I am trying to get the hibernate.reveng.xml to customize the reverse engineering so it will be as desired. I have read the Hibernate Tools Reference Guide version 3.2.4.CR2 from the JBoss Tools CR2 Doc site, as well as the one at Hibernate.org (which is quite similar).
|
They point to the same location so no wonder ;)
anonymous wrote :
| I get the following error when I try to generate the entities:
|
| Exception while generating code
| | Reason:
| | org.hibernate.MappingException: Could not configure overrides from file: C:\apps\workspace3.4.2\infosys-ejb\.settings\hibernate.reveng.xml
| | Could not configure overrides from file: C:\apps\workspace3.4.2\infosys-ejb\.settings\hibernate.reveng.xml
| | org.hibernate.MappingException: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
| | java.lang.StringIndexOutOfBoundsException: String index out of range: 0
| | org.hibernate.MappingException: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
| | java.lang.StringIndexOutOfBoundsException: String index out of range: 0
| | java.lang.StringIndexOutOfBoundsException: String index out of range: 0
| | String index out of range: 0
| |
| This is using 3.0.x branch nightly on top of eclipse 3.4.2
|
Full stacktrace ? matching reveng.xml ?
anonymous wrote :
| A useful addition to the documentation would be examples of how to reverse engineer:
| 1. OneToOne unidirectional
| 2. OneToOne bidirectional
|
Have a one-to-one foreign key constraint setup (join btw. primary key's) and if you want to exclude one side use one-to-one or inverse-one-to-one under foreign key.
anonymous wrote :
| 3. OneToMany unidirectional
| 4. ManyToOne unidirectional
| 5. OneToMany bidirectional
|
That is what all the examples is about in the refdoc.
Have a one-to-many foreign key (join btw. primary key and a non-primary-key) and use set and many-to-one below foreign-key to control it.
[qoute]
6. ManyToMany unidirectional
7. ManyToMany bidirectional
Have a many-to-many association (middle table where primary keys are used to point to two different tables)
Please remember that if we were to support all possible mappings then reveng.xml would grow into what .hbm.xml is today - that being said I did recently add improvements in this area (i.e. support for cascade, one-to-one and a few other attributes), they just need to be added to the docs.
anonymous wrote :
| How should one reverse engineer JoinTable mapping in all of the above, as well as foreign key mapping, and primary key join columns where those are appropriate?
|
Not sure what you mean here ?
anonymous wrote :
| Is it possible to specify how to handle composite primary keys (@IdClass vs. @EmbeddedId)?
|
No, @IdClass is what we support since @EmbeddedId has issues (i.e. I implement good practices in the reverse engineering defaults - if someone want's to add @EmbeddedId support which is not a trivial task thenI gladly accept contributions)
anonymous wrote :
| Also, how to specify the type of collection (Collection, Set, List, Map)?
|
There is nothing in database meta data that can give us that info (bag we could do, but List/Map is tricky) so would be needed to add to the reverse engineering part - contributions welcome.
anonymous wrote :
| Also wonderful would be how to reverse engineer inheritance strategies (SINGLE_TABLE, TABLE_PER_CLASS, JOINED)
|
Again, contributions welcome. Finding a way to do this reliably and in reveng.xml without it turning into hbm.xml is welcomed.
anonymous wrote :
| Finally, is it possible to reverse engineer an entity with properties from multiple tables (@SecondaryTable)?
|
No.
anonymous wrote :
| The reason for all of these questions, is that there is the large ripple effect to generated artifacts when the relationships are not as desired.
|
Understood, but it is a balance act. Contributions are very much welcome.
anonymous wrote :
| The current default seems to aggressively add reverse engineered relationships (even in the absence of foreign key constraints in the DB)
I assure you that we aren't adding relationships without foreign key constraints in the database. We have no "automatic guessing based on column names or anything".
anonymous wrote : so knowing how to eliminate undesired ones is also important.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4215599#4215599
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4215599
17 years, 1 month
[JBoss Cache: Core Edition] - Using Jboss Cache Core 3 or 2 in Jboss 4.3
by yousuf.raza
We are trying to use Jboss Cache 3 in Jboss 4.3.
We have packaged the jboss cache, jgroups and jboss-common-core jar in our application ear and we have scoped the classloading of the ear turned javaParent2Delegation off.
As a result classes that are available in those jars are used by our application.
However the problem arises because of conflicts between jboss-common-core 2.2.1 GA (which is required by jboss cache 3.0.3) and the jboss-common jar in the app server.
The jboss-common-core 2.2.1 jar contains a lot of newer Jboss core classes which causes issues when our application wants to access our deployed xa data sources from the jndi.
If I remove the org.jboss.util.naming packages from the jboss-common-core 2.2.1 jar our applications seems to be working fine. But I see there are a lot of classes in that jar that might cause issues in the future. (eg. org.jboss.util.loading, org.jboss.util.collection packages etc.)
I cannot avoid using the jboss-common-core 2.2.1 jar since the following classes are not present in jboss 4.3:
org.jboss.util.stream.MarshalledValueInputStream
org.jboss.util.stream.MarshalledValueOutputStream
org.jboss.util.id.GUID
So basically using the jboss cache 2 or 3 inside Jboss 4.3 is not going to work.
The only hacky solution seems to be to remove everything from jboss-common-core 2.2.1 jar except for the 3 classes above and see if that works.
Again this might not work since these classes might depend on newer version of other core classes which I would have to add back.
The documentation about using jboss cache 2 in jboss 4 uses a very simplistic sample webapp which has a servlet which puts an int in the cache on every access of the servlet.
Since it does not use any other jboss services (like looking up a data source etc.) I am not really sure that you can really use jboss cache 2 or 3 in jboss 4.3 based on my experience.
Any other suggestions are welcome ? Also if I hack the jboss-common-core jar to only contain the classes needed by jboss cache would that be ok ?
I am not comfortable with the hacky solution but wanted more input from people who know the jboss cache better than I do.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4215592#4215592
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4215592
17 years, 1 month