If you rewrite the annotations in HBM XML files, you could maintain two sets of such XML and pick which ones to use via bernate's mapping directives. I've done this in but not in a J2EE/JPA environment so I don't know if there are any gotchas in that respect.
If you rewrite the annotations in HBM XML files, you could maintain two sets of such XML and pick which ones to use via bernate's mapping directives. I've done this in but not in a J2EE/JPA environment so I don't know if there are any gotchas in that respect. The biggest downside is it likely will be a lot of work to remove all your annotations and rebuild them in XML.
I would say that if your annotations are database specific, you're doing it wrong.
In the real world, where the terms 'legacy', and 'existing application' are used, saying "you're doing it wrong" isn't helpful. Trying to bridge the gap between Oracle and SQL Server, who have idealogical differences on database design, is going to require differences in configuration (i.e. Annotations) – rynmrtn Jul 12 '10 at 16:42 @rynmrtn: I think what he's trying to point out is that JPA should already be database independent... the datastore is already configurable via persistence.xml.
– Powerlord Jul 12 '10 at 16:58 s answer specifically referenced database-specific annotations, not persistence.xml. It's still a non-answer. – rynmrtn Jul 12 '10 at 17:26 I stand by this answer in general for ORM's.
That said, i'll try to give some targeted advice in another answer. – james Jul 12 '10 at 17:50.
I think that if you don't use AnnotationConfiguration when configuring your SessionFactory, the annotations will be omitted. So, use Configuration.
For your generator problem (for which the solution would normally be "use the native generator" but doesn't work for you due to working with a legacy db), you could probably extend the SQLServerDialect and override the getNativeIdentifierGeneratorClass to return a (possibly custom) generator that does what you need for your legacy db.
I have come across the need to mix-n-match legacy with new schemas/databases before in a Grails (GORM) application, which of course is running Would not say "you're doing it wrong" - but I would keep the JPA @Annotations to the very basics like @Entity and @Column and leave it to the which is also specified in the XML configuration file. You might experiment with subclassing the Oracle10gDialect with one that assigns a sequence generator to all tables, versus a Sybase one which does not. Please see this post on how to implement this.
UPDATE: What james and I are suggesting (almost in the same minute) is to setup multiple persistence-unit sections of your persistence. Xml file. This allows one to use @Entity and @Id without supplying details in the class.
The details come in the hibernate. Dialect property. I suggested subclassing Oracle10gDialect (and james the SQLServerDialect) - those would do the choosing as to the table naming, id generator strategy, etc.See --> https://forum.hibernate.
Org/viewtopic. Php? F=1&t=993012.
– rynmrtn Jul 12 '10 at 18:08 What james and I are suggesting (almost in the same minute) is to setup multiple persistence-unit sections of your persistence. Xml . This allows you to use @Entity and @Id without supplying details in the class.
– mikesalera Jul 12 '10 at 21:30.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.