Identify Hibernate version
by Dmitry Geraskov
Hi, guys,
could you please tell me how to identify hibernate version used at run time.
I expected to get it from org.hibernateVersion , but the code is:
public class Version {
public static String getVersionString() {
return "[WORKING]";
}
...
}
Could you please help?
Thanks,
Dmitry Geraskov
12 years
How to custom ClassLoaderService in hibernate 4?
by ☜鸵☞
Such as the title, is there anyone can tell how to custom ClassLoaderService in hibernate 4? I've try to define a ClassLoader, the methods overrided contains findClass, loadClass, findResource, and findResources.
I set the ClassLoader as the ClassLoader of Hibernate, Environment, Application, and Resource in OSGi. There's not clearly right. The codes was following:
/***********************Code Begin************************/
BootstrapServiceRegistry bootstrapServiceRegistry = new BootstrapServiceRegistryBuilder()
.withHibernateClassLoader(classLoader)
.withEnvironmentClassLoader(classLoader)
.withApplicationClassLoader(classLoader)
.withResourceClassLoader(classLoader).build();
Properties properties = configuration.getProperties();
Environment.verifyProperties(properties);
ConfigurationHelper.resolvePlaceHolders(properties);
final ServiceRegistry serviceRegistry = new ServiceRegistryBuilder(
bootstrapServiceRegistry).applySettings(properties)
.buildServiceRegistry();
configuration.setSessionFactoryObserver(new SessionFactoryObserver() {
private static final long serialVersionUID = 1L;
@Override
public void sessionFactoryCreated(SessionFactory arg0) {
// TODO Auto-generated method stub
}
@Override
public void sessionFactoryClosed(SessionFactory arg0) {
((StandardServiceRegistryImpl) serviceRegistry).destroy();
}
});
configuration.buildSessionFactory(serviceRegistry);
/***********************Code End************************/
The classLoader in the codes which is defined by myself.
It's fail to achieve the effect of mine, so I winna custom the ClassLoaderService.
12 years
Re: [hibernate-dev] hibernate-dev Digest, Vol 70, Issue 9
by William Riley-Land
Mongo can index on any field, so it shouldn't be slow to ignore _id. It is akin to a rowid/oid. Although, people seem to have started to use SOLR to index MongoDB (still wrapping my head around this), so maybe your concern is valid.
William P. Riley-Land
Sole Proprietor
Software Engineer
Riley-Land Software
http://william.nodejitsu.com/
573.268.4900
On Apr 7, 2012, at 11:00 AM, hibernate-dev-request(a)lists.jboss.org wrote:
> Send hibernate-dev mailing list submissions to
> hibernate-dev(a)lists.jboss.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
> or, via email, send a message with subject or body 'help' to
> hibernate-dev-request(a)lists.jboss.org
>
> You can reach the person managing the list at
> hibernate-dev-owner(a)lists.jboss.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of hibernate-dev digest..."
>
>
> Today's Topics:
>
> 1. [OGM] MongoDB dialect and treatment of _id (Emmanuel Bernard)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 6 Apr 2012 18:41:42 +0200
> From: Emmanuel Bernard <emmanuel(a)hibernate.org>
> Subject: [hibernate-dev] [OGM] MongoDB dialect and treatment of _id
> To: hibernate-dev(a)lists.jboss.org
> Message-ID: <5AD5A697-8C7C-42B7-8DF7-B5ADDDD54803(a)hibernate.org>
> Content-Type: text/plain; charset=us-ascii
>
> I would like to discuss the problem of _id in MongoDB and how to map that in Hibernate OGM.
>
> MongoDB is a bit psycho-rigid in how it uniquely identifies a document. A special property named _id is used for that and must be unique across a collection. It is also strongly recommended to let MongoDB generate this id (a UUID essentially).
>
> In the MongoDb dialect we have not settled on how to use _id. and I would like to clarify that. Today we use `dbObject.put(ID_FIELDNAME, key.getColumnValues()[0])` but that is only correct if the id property is mapped to a single column. (ie `key.getColumnNames().length == 1`)
>
> ## Use _id as a OracleDB rowid
>
> We could decide to use _id as a purely internal identifier for a document and basically never ever rely on it. All queries and lookup with use the identifier columns and their value to find a document.
> That has the benefit of not having to deal with _id but I don't know if that's an OK practice in MongoDB or if it's not recommended at all as it would lead to costly lookups. Anybody familiar with MongoDB can shime in?
>
> ## Map _id when we have a identifier mapped on one column
>
> In this case, I will only discuss the case where an id is mapped to a single column.
> We could decide to map the id column value to both the id column and to _id. That creates some duplication but OGM would be happy and MongoDB's queries could be efficient.
> Alternatively, we could decide to completely ignore the id column name and use _id for this. The TupleShapshot would then be responsible for binding the id column name to the value stored in _id. My concern with the alternative is that someone reading the data from the mongodb store will not find the JPA id column but rather see _id. On the other hand it seems to be the norm in the MongoDB land.
>
> ### Identifiers mapped on several columns
>
> In this case, we have three approaches that can be combined:
>
> 1. treat _id as rowid (see avove)
> 2. map id values as a complex object and put that in _id eg { "_id": { "firstname": "Emmanuel", "lastname": "Bernard"} }
>
> Note that we can then decide to bind the id columns as top level attributes of the document as well.
>
> Do you guys have any thoughts on the best approach?
>
>
> ------------------------------
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>
> End of hibernate-dev Digest, Vol 70, Issue 9
> ********************************************
12 years
Assistance requested for graduate research
by Phillip Meyer
Greetings Hibernate Developers,
I'm a computer science graduate student, and in my master's thesis I am
working on evaluating algorithms that would select the "core" of a complex
software system. The intuitive definition I am working with for this core
is: *A subset of the software system that when studied, efficiently
imparts understanding of the total system.*
The idea is that when a new developer comes onto an unfamiliar (and
possibly poorly documented) project, if they start with learning how this
core set of most important classes work first, it will be easier for them
to understand the system as a whole. I've got a few different potential
algorithms I'd like to validate, and one way to do so is to compare the
output with a list of what the actual developers consider the core classes.
So that's where you guys come in. One of the software projects I've been
working with for this is Hibernate Core. If any knowledgeable developers
would be willing to compile such a list of important classes for this
project, it would be a huge benefit for my research. One list would be
great, or if a few are interested in participating, the more the better. I
can expand the guidelines a bit for what I am looking for, but I wanted to
see if anyone was interested in assisting first.
If any list like this already exists, please let me know. If anyone has
any questions, suggestions, or criticisms, feel free to offer them.
Thanks!
Phil Meyer
12 years
changelog and already-solved issues
by Sanne Grinovero
It seems that the JGroups refactoring in Search done to share a single
Channel resolved a critical problem, but I wasn't aware of it.
Would it make sense to open an "after the fact" issue and mark it
solved for the already-released 4.1.0.Final ?
It was embarrassingly wrong, but now that it's solved without anything
tracking it, I don't want to hide the skeleton in the closet..
Cheers,
Sanne
12 years
starting release
by Steve Ebersole
I am starting the release process for ORM 4.1.2. Please do not push
changes to master for the time being. Thanks.
--
steve(a)hibernate.org
http://hibernate.org
12 years