Inconsistent projection result
by Marc Schipperheyn
Projecting on an id is giving me inconsistent results.
On the same method, sometimes a String is returned, other times a Number.
I'm even seeing this difference running the test twice in a row.
I haven't been able to find what makes it switch, but I am 100% sure it
happens. I have this structure.
List<Object[]> result = fts .createFullTextQuery( mj.createQuery(),
BaseWallPost.class) .setProjection(ProjectionConstants.ID, "post.id")
.list(); for(Object[] tuple : result){ // Long postId = tuple[1] != null?
Long.valueOf((String) tuple[1]) : null; Long postId = (Long) tuple[1]; }
@Entity public abstract class BaseComment{ @Id @GeneratedValue(strategy =
GenerationType.AUTO) @Column
@Field(name="longCommentId",index=Index.YES,store=Store.YES,analyze=Analyze.NO)
@DocumentId public Long id; } @Entity public abstract class BasePost
extends BaseComment{ @ManyToOne @JoinColumn
@IndexedEmbedded(includePaths={"id","type","longCommentId"},indexNullAs=Field.DEFAULT_NULL_TOKEN,includeEmbeddedObjectId=true)
@ContainedIn//Update the shareCount public Post post; } @Entity public
class Post extends BasePost{ } @Entity public class Comment extends
BaseComment{ @ManyToOne @JoinColumn
@IndexedEmbedded(includePaths={"id","type","blocked","longCommentId"},indexNullAs=Field.DEFAULT_NULL_TOKEN,includeEmbeddedObjectId=true)
@ContainedIn public BasePost post; }
9 years, 10 months
Sequence Pool
by Janario Oliveira
Hi guys,
I am migrating some code base and I have some problems using sequence.
As I see it works with a pool together to allocationSize. But it expects
that the sequence have the same increment by (50 as default).
Is there a global configuration that disable pool and always read from the
sequence?
In my case scripts are generated manually and everyone will have to
remember to add increment by 50 or allocationSize = 1.
Also this would change order creation vs order id.
e.g.
If I create 2 rows with hibernate it will keep pooling from 1 to 50. (id 1
and 2)
After that some procedure or script can create another one with nextval of
the sequence. (id 51)
Next hibernate create another row. (id 3)
The right order of creation is: 1, 2, 51, 3
But ordering by id will load a wrong order.
9 years, 10 months
Multiple joined-subclass mappings to same table
by Unmesh Joshi
Hi,
I am bit puzzled with this. I am looking at a codebase, where there are
multiple joined-subclass mappings (in separate hbm.xml files) which map to
same table. For union-subclass, we correctly get exception for duplicate
mapping. But for joined-subclass it allows multiple mappings to same table.
In the hibernate source code, I see that for Joined subclass, the table
mapping is added with following method call.
Table mytable = mappings.addTable(
schema,
catalog,
getClassTableName( joinedSubclass, node, schema, catalog, null, mappings ),
getSubselect( node ),
false
For union-subclass, the mapping gets added with
Table mytable = mappings.addDenormalizedTable(
schema,
catalog,
getClassTableName(unionSubclass, node, schema, catalog,
denormalizedSuperTable, mappings ),
unionSubclass.isAbstract() != null && unionSubclass.isAbstract(),
getSubselect( node ),
denormalizedSuperTable
);
mappings.addTable doesnt throw exception if the table mapping already
exists.
Is the behaviour for joined subclass by design? Because I see this fact
being used in some projects, where to extend an already created
joined-subclass, a new hibernate-config file is added with joined-subclass
definition duplicated, with additional attributes (and columns) added to
existing table. So essentially, you have two joined-subclass definitions,
mapping two separate entities to same table.
This does look like using some loop hole in the code?
Thanks,
Unmesh
9 years, 10 months
Updated JDKs on ci.hibernate.org
by Sanne Grinovero
Hi all,
I just downloaded these versions of the OpenJDK and replaced the
existing ones on ci.hibernate.org:
jdk-7u80-ea-bin-b05-linux-x64-20_jan_2015.tar.gz
jdk-8u40-ea-bin-b23-linux-x64-27_jan_2015.tar.gz
jdk-9-ea-bin-b49-linux-x64-04_feb_2015.tar.gz
I now triggered several builds of various JDK/project combinations. I
don't expect any regression, but in case there are broken builds,
that's an additional reason to consider.
Thanks,
Sanne
9 years, 10 months
autosuggest
by Marc Schipperheyn
Lucene 4 has some great improvements in autosuggest/autocomplete,
e.g.AnalyzingInfixSuggester.
GroupingSearch and JoinUtil are other nice ones.
It would be interesting to see blog writeups on leveraging these new
features through HSearch.
Joins should imho even be considered as candidates for inclusion into the
querybuilder. Grouping might also be considered as a kind of projection
perhaps.
9 years, 10 months
@IndexedEmbedded ids numeric in stead of Strings
by Marc Schipperheyn
I'm noticing that on @IndexedEmbedded HSearch 5, an id reference is indexed
as a numeric field, when, that same id is indexed as a string being a
@DocumentId. I had some seemingly inconsistent behaviour in my tests so now
I'm not so sure what is the intended behaviour?
So,
@Entity
@Indexed
public class Post{
@Id
@DocumentId
private Long id;
@ManyToOne
@IndexedEmbedded(includePaths={"id"})
private Post parent;
}
id would be a string
parent.id would be numeric
is this intended? I guess I can see the logic but it seems a little
inconsistent and something that should be mentioned in the migration guide.
Cheers,
Marc
9 years, 10 months
did hibernate.org crash?
by Scott Marlow
Trying to open http://hibernate.org/dtd/hibernate-configuration-3.0.dtd,
gives a:
"
Site temporarily disabled
This page has been temporarily disabled due to a misconfigured custom
domain.
Are you the site owner? Follow the instructions for setting up a custom
domain with GitHub pages to update your site's DNS records to point to
the proper IP address.
You can find more information in our GitHub Pages legacy IP deprecation
blog post. If you have any questions, please contact support.
"
The above causes a WildFly test failure http://pastebin.com/fm8VMCcb
(from org.hibernate.service.internal.JaxbProcessor.unmarshal).
Scott
9 years, 10 months