Uploaded image for project: 'Hibernate Search'
  1. HSEARCH-1786

Projection on properties from embedded types returns String rather than the mapped type

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.1.Final
    • Fix Version/s: 5.1.0.Final
    • Component/s: None
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

      Description

      Before HSearch 5 projecting on post.id returned a long. Now it returns a string. It might because the @Field approach I use is no longer valid. Please advise.

      public class WallPost{
      	@Id
      	@GeneratedValue(strategy = GenerationType.AUTO)
      	@Column(name = "postId", updatable = false, insertable = false)
      	//Storing the id to deal with https://blog.trifork.com/2012/01/22/query-time-joining-in-lucene/
      	@Field(name="baseCommentId",index=Index.YES,store=Store.YES,analyze=Analyze.NO,bridge=@FieldBridge(impl=LongBridge.class))
      	@DocumentId
      	public Long getId() {
      		return id;
      	}
      	@ManyToOne(fetch=FetchType.LAZY,optional=true)
      	@JoinColumn(name="FK_PostId",nullable=true,insertable=true,updatable=false)
          @IndexedEmbedded(includePaths={"id","type","baseCommentId"},indexNullAs=Field.DEFAULT_NULL_TOKEN)
      	@ContainedIn
      	public WallPost getPost() {
      		return post;
      	}
      
      .createFullTextQuery(
      	mj.createQuery(), 
      WallPost.class)
      .setProjection(ProjectionConstants.ID, "post.id")
      

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                sanne Sanne Grinovero
                Reporter:
                mschipperheyn2 MarcS
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: