Earlier quoted context omitted.
Just plugged it in to SJ.se (Swedish rail). Doesn’t even have Hamburg as a selection. So I need to somehow know that Deutsche Bahn ofers the search capability. True two to three train changes, 90 to 220 euro. I guess I’ll use bahn.de from now on (and learn some German :) )
The best option should have one change, since there are direct trains from Stockholm to Copenhagen, and from Copenhagen to Hamburg (this train goes on the ferry). I would expect an additional change in Malmoe could reduce the cost and increase the time. If you search for "now", it's 22:52, so you may get odd connections as the journey planner tries to make an overnight journey.
Wow, how does a train go on a ferry? A full, long train with many cars? Then the ferry would have to be that long too, which seems unlikely. Or is it that one or a few cars of the train go on each trip of the ferry, and the cars are all connected back together when back on land?