Hibernate lazy loading doesn't work (@JoinColumnOrFormulas)

You don’t need @JoinColumnsOrFormulas here. Use @JoinColumns instead as explained in this article:

@ManyToOne(fetch = FetchType.LAZY)
//Relying on @NotFound is relational database code smell
//@NotFound(action = NotFoundAction.IGNORE) 
@JoinColumns({
	@JoinColumn(
		name = "STOCKGROUPCODE",
		referencedColumnName = "GD_CODEID"),
	@JoinColumn(
		name = "STOCKGROUP",
		referencedColumnName = "GD_CODETYPE")
})
private StockGroup stockGroup;

If it does not work, send us a Pull Request with a replicating test case as explained in this post.