Of the two, my preference is the first method:
function insertIntoDatabase(Account account, Otherthing thing) {
database.insertMethod(account.getId(), thing.getId(), thing.getSomeValue());
}
The reason being that changes made to either object down the road, as long as the changes preserve those getters so the change is transparent outside of the object, then you have less code to change and test and less chance of disrupting the app.
This is just my thought process, mostly based on how I like to work and structure things of this nature and which prove to be quite manageable and maintainable in the long run.
I am not going to get into naming conventions but would point out that although this method has the word "database" in it, that storage mechanism can change down the road. From the code shown, there is nothing tying the function to the database storage platform being used -- or even if it is a database. We just assumed because it is in the name. Again, assuming those getters are always preserved, changing how/where these objects are stored will be easy.
I would re-think the function and the two objects though because you have a function that has a dependency on two object structures, and specifically the getters being employed. It also looks like this function is tying those two objects into one cumulative thing which gets persisted. My gut is telling me that a third object might make sense. I'd need to know more about these objects and how they relate in actuality and the anticipated roadmap. But my gut is leaning in that direction.
As the code stands now, the question begs "Where would or should this function be?" Is it part of Account, or OtherThing? Where does it go?
I guess there is a third object "database" already, and I am leaning towards putting this function into that object, and then it becomes that objects job to be able to handle an Account and an OtherThing, transform, and then also persist the result.
If you were to go as far as make that 3rd object conform to an object-relational mapping (ORM) pattern, all the better. That would make it very obvious to anyone working with the code to understand "Ah, this is where Account and OtherThing get smashed together and persisted".
But it could also make sense to introduce a forth object, which handles the job of combining and transforming an Account and an OtherThing, but not handle the mechanics of persisting. I'd do that if you anticipate a lot more interactions with or between these two objects, because at that grows I would want the persistence bits factored out into an object that manages the persistence only.
I would shoot for keeping the design such that any one of the Account, OtherThing, or the third ORM object can be changed without having to also change the other three. Unless there is a good reason not to, I'd want Account and OtherThing to be independent and not have to know the inner workings and structures of each other.
Of course, if I knew the full context that this is going to be, I might change my ideas completely. Again, this is just how I think when I see things like this, and how a lean.